Task randomly get stuck (between parent and child)
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- python
- Domain
- distributed-systems
Research direction
Start with the pool handoff path in billiard/pool.py, then trace queues.py and connection.py from the reported recv_bytes stack trace. Try to reproduce the rare parent-child stall with Celery 5.2.3 and billiard 3.6.1.0, and inspect whether a regression test can demonstrate the failure. Done means identifying and correcting the stuck handoff, with the task resubmitted or timed out rather than remaining stuck forever.
Written by the indexing model from the issue text.
Description
We use celery 5.2.3 and billiard 3.6.1.0. What we observe is the main worker receives a task (we can see task_received signal being fired) and then there is no trace of the task in the logs after that (not always and very rarely).
The main worker thinks it has sent the task on the pipe whereas the child is still stuck on read. As ack is not received by the main worker the timers (soft and hard) also don't fire. This task is now stuck forever. When we kill the child process the task is sent to another worker. The main worker meanwhile was directing new tasks to other children successfully.
This happens very randomly (after weeks of running normally) in production.
Stacktrace of the child when it was sent SIGUSR1:
Pool process <celery.concurrency.asynpool.Worker object at 0x7f1d1c1cf850> error: SoftTimeLimitExceeded()
Traceback (most recent call last):
File ".../python/lib/python3.9/site-packages/billiard/pool.py", line 292, in __call__
sys.exit(self.workloop(pid=pid))
File ".../python/lib/python3.9/site-packages/billiard/pool.py", line 351, in workloop
req = wait_for_job()
File ".../python/lib/python3.9/site-packages/billiard/pool.py", line 473, in receive
ready, req = _receive(1.0)
File ".../python/lib/python3.9/site-packages/billiard/pool.py", line 445, in _recv
return True, loads(get_payload())
File ".../python/lib/python3.9/site-packages/billiard/queues.py", line 355, in get_payload
return self._reader.recv_bytes()
File ".../python/lib/python3.9/site-packages/billiard/connection.py", line 243, in recv_bytes
buf = self._recv_bytes(maxlength)
File ".../python/lib/python3.9/site-packages/billiard/connection.py", line 460, in _recv_bytes
return self._recv(size)
File ".../python/lib/python3.9/site-packages/billiard/connection.py", line 422, in _recv
chunk = read(handle, remaining)
File ".../python/lib/python3.9/site-packages/billiard/pool.py", line 229, in soft_timeout_sighandler
raise SoftTimeLimitExceeded()
billiard.exceptions.SoftTimeLimitExceeded: SoftTimeLimitExceeded()
The fact that when we killed this child, the task gets resubmitted to another child makes me think that the parent thought it sent the task on pipe and was waiting for ack whereas the receiver was stuck on read (forever). Could it be because of some race in the receiver or sender?
- 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