Repository navigation
Conversation
tzifudzi
force-pushed
the
forkserver-restart-dead-server
branch
4 times, most recently
from
November 28, 2026 21:13
e0c424d to
2084796
Compare
The fork server is started once and never checked again. If it dies, every later attempt to start a process fails with ConnectionRefusedError, because nothing listens on its socket any more, so a pool can no longer replace its workers. Before asking for a new process, check whether the fork server has exited, as CPython does (python/cpython#75489). If it has, forget it and start a new one. If that start fails, the next call tries again. Only the process that started the fork server can check on it. A process the server started, or a forked copy of the one that started it, keeps using it without checking, as billiard does today. CPython instead starts a second fork server in the first case and raises ChildProcessError in the second. A pool worker that failed to start stayed in the pool, and cleaning it up at the next maintenance raised KeyError because it was never registered under a pid. Clean it up without raising, so the pool goes on to start a replacement. Part of celery/celery#11096
tzifudzi
force-pushed
the
forkserver-restart-dead-server
branch
from
November 28, 2026 21:15
2084796 to
9d0e7e9
Compare
This was referenced Nov 28, 2026
tzifudzi
marked this pull request as ready for review
November 28, 2026 22:35
Author
|
@auvipy regarding enhancement celery/celery#11096, ready with PRs now, please review. Separated PRs into separate granular changes to make them easier to review. |
auvipy
self-requested a review
November 29, 2026 02:16
Member
|
OK |
Member
|
please dont force push, I am not sure why the Unit test builds are not triggered though |
Author
|
Got it won't force push on future PR edits, seems unit tests are triggered now, they need a maintainer to trigger workflows it seems |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
billiard starts the fork server once and never checks on it again. If the fork server dies, every later attempt to create a worker fails with
ConnectionRefusedError, because nothing is listening on its socket any more. The pool can then no longer replace workers that exit.Fix
ForkServer.ensure_runningnow checks whether the fork server has exited before asking it for a new process, the way CPython does (python/cpython#75489). If it has, billiard forgets it and starts a new one. If that start fails, the next call tries again.Related PRs
Report the parent's fd numbers from forkserver pool workers celery/billiard #483
Replace the fork server on pool restart celery/billiard #485
Support forkserver as a prefork start method celery/celery #11177
Support preloading modules in the fork server celery/celery #11178