Propagate MemoryError from pool callbacks - #451
Merged
auvipy merged 1 commit intoAug 13, 2026
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates billiard.pool.ApplyResult callback execution so that MemoryError raised inside pool callbacks is propagated instead of being logged and swallowed, matching Celery’s expectation on Python 3 and avoiding situations where acks_late tasks can remain unacknowledged.
Changes:
- Update
ApplyResult.safe_apply_callback()to explicitly re-raiseMemoryError(while preserving existingcallbacks_propagatebehavior for other exception types). - Add a unit regression test that exercises the
ApplyResult._set()→ callback path and assertsMemoryErrorpropagation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
billiard/pool.py |
Ensures MemoryError from ApplyResult callbacks escapes instead of being logged/swallowed. |
t/unit/test_pool.py |
Adds regression coverage proving MemoryError propagates through ApplyResult._set() callback execution. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
auvipy
approved these changes
Aug 13, 2026
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.
Summary
MemoryErrorraised by pool callbacks instead of logging andswallowing it.
ApplyResult._set()callback path.On Python 3,
MemoryErroris anException, so the generic callback handlercurrently catches it. Celery's request callback expects this exception to escape,
and swallowing it can leave an
acks_latemessage unacknowledged. The explicitMemoryErrorbranch restores propagation without changing how other callbackexceptions or
callbacks_propagateare handled.Related to celery/celery#10462. A Celery regression around
Request.on_failureremains a follow-up after the billiard behavior is available.
Validation
All tests were run in an isolated Python 3.12 Docker container.
DID NOT RAISE MemoryErrorandlogged the callback exception.
python -m pytest t/unit/test_pool.py -q: 6 passed.python -m pytest t/unit -q: 39 passed, 51 skipped.python -m compileall -q billiard t/unit: passed.git diff --check: passed.AI disclosure
This PR includes AI-assisted code understanding to speed up the process; the
implementation and tests were updated and reviewed manually with AI assistance.