Skip to content

Add MemoryError regression for request callbacks - #10482

Merged
auvipy merged 3 commits into
celery:mainfrom
sahilmathur254:fix/10462-when-using-acks-late-a-memoryerror-w
Aug 16, 2026
Merged

auvipy merged 3 commits into
celery:mainfrom
sahilmathur254:fix/10462-when-using-acks-late-a-memoryerror-w

Conversation

@sahilmathur254

Copy link
Copy Markdown
Contributor

Description

Add focused regression coverage for the Celery request callback path when an acks_late task fails with MemoryError.

The pool reports the traced task failure through Request.on_success(), which delegates to Request.on_failure(). Celery intentionally raises a new MemoryError from that path, but Billiard previously caught and swallowed it. celery/billiard#451 corrected the complementary pool callback behavior so MemoryError now propagates.

This test constructs the traced MemoryError, passes it through the optimized request class's on_success() callback, and verifies that the real on_failure() handler raises the transformed Process got: out of memory exception. It covers Celery's side of the callback contract without duplicating Billiard's ApplyResult regression.

Related to #10462.

Validation

  • python -m pytest -q t/unit/worker/test_request.py: 142 passed, 3 warnings.
  • Focused MemoryError and callback-path tests: 3 passed.
  • python -m compileall -q t/unit/worker/test_request.py: passed.
  • Flake8, isort, codespell, pyupgrade, and yesqa checks passed for t/unit/worker/test_request.py.
  • git diff --check: passed.

Risk

Low. This is a test-only change and does not alter Celery runtime behavior or dependency constraints.

AI disclosure

This PR includes AI-assisted code understanding to speed up the process; the test was updated and reviewed manually with AI assistance.

@sahilmathur254
sahilmathur254 marked this pull request as ready for review August 13, 2026 18:10
@auvipy
auvipy requested review from auvipy and a lite review from Copilot August 16, 2026 13:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a focused unit-test regression to ensure Celery’s Request.on_success() callback path correctly propagates a MemoryError (via Request.on_failure() raising MemoryError("Process got: ...")) when acks_late is enabled, aligning with the expected pool callback contract referenced in #10462.

Changes:

  • Add a unit regression test covering Request.on_success() → Request.on_failure() behavior when the traced exception is MemoryError under acks_late.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@auvipy auvipy added this to the 5.7.0 milestone Aug 16, 2026
@codecov

codecov Bot commented Aug 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.69%. Comparing base (2f3cd2f) to head (f4d47a7).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10482   +/-   ##
=======================================
  Coverage   88.69%   88.69%           
=======================================
  Files         153      153           
  Lines       19859    19859           
  Branches     2313     2313           
=======================================
  Hits        17613    17613           
  Misses       1948     1948           
  Partials      298      298           
Flag Coverage Δ
unittests 88.66% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@auvipy
auvipy merged commit 576d4be into celery:main Aug 16, 2026
350 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants