try/except not working on WorkerLostError and signal 11
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with the WorkerLostError and SIGSEGV log shown in the issue, then trace how the bound task's try/except and task_failure.connect entry points are involved in worker-process termination. Compare the observed behavior with the project's worker-loss tests or documentation; done means establishing and testing a supported way to observe or log this failure, if one exists.
Written by the indexing model from the issue text.
Description
Hi,
Is there a way to catch the WorkerLostError exception when it does die from a SIGSEGV? It seems like this might be unavoidable in some cases because of OOM issues for certain CPU-intensive tasks. In which case I'd like to log it. But I can't seem to tap into the worker or celery life cycle to do this.
But I haven't been able to try/catch the exception so far, in either celery 4.4.0 or 5.0.0. I've tried modifying the task, and also task_failure.connect, but no luck.
logs:
[2020-10-14 19:23:22,154: ERROR/MainProcess] Process 'ForkPoolWorker-17' pid:48328 exited with 'signal 11 (SIGSEGV)'
[2020-10-14 19:23:22,170: ERROR/MainProcess] Task handler raised error: WorkerLostError('Worker exited prematurely: signal 11 (SIGSEGV).')
[2020-10-14 19:23:22,403: DEBUG/ForkPoolWorker-18] Using selector: KqueueSelector
the relevant celery code:
@app.task(bind=True, base=CalculationTask)
def async_calculate(self, id, **kwargs):
serializer = get_serializer(id)
try:
return serializer.run()
except Exception as e:
print("ERROR")
print(e)
...
@task_failure.connect
def task_fail_handler(sender, result, **kwargs):
print("task_fail_handler ERROR")
Excuse the print statements :) but for whatever reason, I can't seem to capture this exception. Neither are getting triggered.
- Dominant language
- Python
- Stars
- 436
- Forks
- 273
- Avg merge
- 4d 19h
- Merged PRs (30d)
- 5
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from celery/billiard
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
return in finally can swallow exceptionsMay be free again @auvipy claimed this 602 days ago, and no pull request is open. Open
celery/billiard#414 · 6 comments · 3 reactions · 1 assignee ·
-
Handling numpyOpen
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
AI bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
AUTO-MAS-Project/AUTO-MAS#1960 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
btclib-org/btclib-wallet#872 ·
Maintainers usually reply within 1 day
-
[Bug]: Scheduled returns scan all accepted minion keys causing extreme loadPossibly taken A pull request linked to this issue is open or already merged. Openbug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
saltstack/salt#70789 · 1 comment ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 87/100
btclib-org/btclib#3093 ·
Maintainers usually reply within 1 day