Repository navigation
Conversation
Expose forkserver through the worker setting and CLI on Linux and macOS. Leave application preloading disabled and cover task dispatch after the pool has used all its children. Part of celery#11096.
Allow prefork workers using forkserver to choose modules to import before workers start. Keep an empty preload list as the default and document that preloaded code is refreshed by a full worker restart. Part of celery#11096.
This was referenced Nov 28, 2026
auvipy
self-requested a review
November 29, 2026 02:09
This branch has not been deployed
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
With
forkserver, each pool child can end up importing the same application modules separately. Celery has no setting to select which modules the fork server should import once so its children can inherit them.Solution
Add
worker_forkserver_preloadand--forkserver-preloadto specify which modules the fork server imports before creating pool children. The list defaults to empty, and a non-empty list requiresforkserver. Restart the whole worker to pick up changes to preloaded modules.Configuration (
celeryconfig.py)CLI
Related PRs
Report the parent's fd numbers from forkserver pool workers celery/billiard #483
Restart the fork server if it dies celery/billiard #484
Replace the fork server on pool restart celery/billiard #485
Support forkserver as a prefork start method celery/celery #11177
Until the start-method PR merges, this draft also shows its changes. The preload changes are in commit
55d104a96.