celery icon indicating copy to clipboard operation
celery copied to clipboard

Nested GroupResult.get(propagate=False) raises with native joins

Open GangEunzzang opened this issue 2 months ago • 0 comments

I found this while testing nested group results. When GroupResult.get(propagate=False) uses a native join, a failed nested child still raises instead of being returned as an exception value.

This report provides a standalone reproducer for #10689.

Reporting checklist

Checklist

  • [x] I have verified that the issue exists against the main branch of Celery.
  • [ ] This has already been asked to the discussions forum first.
  • [x] I have read the relevant section in the contribution guide on reporting bugs.
  • [x] I have checked the issues list for similar or identical bug reports.
  • [x] I have checked the pull requests list for existing proposed fixes.
  • [x] I have checked the commit log to find out if the bug was already fixed in the main branch.
  • [x] I have included all related issues and possible duplicate issues in this issue (If there are none, check this box anyway).
  • [ ] I have tried to reproduce the issue with pytest-celery and added the reproduction script below.

Mandatory Debugging Information

  • [x] I have included the output of celery -A proj report in the issue. (if you are not able to do this, then at least specify the Celery version affected).
  • [x] I have verified that the issue exists against the main branch of Celery.
  • [x] I have included the contents of pip freeze in the issue.
  • [x] I have included all the versions of all the external dependencies required to reproduce this bug.

Optional Debugging Information

These entries refer to the standalone reproducer below.

  • [ ] I have tried reproducing the issue on more than one Python version and/or implementation.
  • [ ] I have tried reproducing the issue on more than one message broker and/or result backend.
  • [ ] I have tried reproducing the issue on more than one version of the message broker and/or result backend.
  • [ ] I have tried reproducing the issue on more than one operating system.
  • [ ] I have tried reproducing the issue on more than one workers pool.
  • [ ] I have tried reproducing the issue with autoscaling, retries, ETA/Countdown & rate limits disabled.
  • [ ] I have tried reproducing the issue after downgrading and/or upgrading Celery and its dependencies.

Related Issues and Possible Duplicates

Related Issues

  • #10689 contains the proposed fix and regression tests.
  • #5496 / #5638 added nested native result support; #5651 / #5679 added the earlier regression test.

Possible Duplicates

  • I did not find an existing report for this specific option-forwarding problem.

Environment & Settings

Celery version: 5.7.0a1 from main at 7b4edf4768262636645076226b4f5a28d5081c7a.

Python 3.12.13, macOS 15.6 arm64, Kombu 5.7.0a1, Billiard 4.3.0. Broker: memory://; result backend: cache+memory://.

app.report() output for the reproducer:

software -> celery:5.7.0a1 (recovery) kombu:5.7.0a1 py:3.12.13
            billiard:4.3.0 memory:N/A
platform -> system:Darwin arch:64bit
            kernel version:24.6.0 imp:CPython
loader   -> celery.loaders.app.AppLoader
settings -> transport:memory results:cache+memory://

broker_url: 'memory://:********@localhost//'
result_backend: 'cache+memory://'
deprecated_settings: None

Steps to Reproduce

Required Dependencies

  • Minimal Python Version: Unknown; reproduced with CPython 3.12.13
  • Minimal Celery Version: Unknown; reproduced on main at 7b4edf4768262636645076226b4f5a28d5081c7a
  • Minimal Kombu Version: Unknown; reproduced with 5.7.0a1
  • Minimal Broker Version: N/A; no external broker is needed
  • Minimal Result Backend Version: Built-in cache+memory:// backend
  • Minimal OS and/or Kernel Version: Unknown; reproduced on macOS 15.6 / Darwin 24.6.0 arm64
  • Minimal Broker Client Version: N/A; the script does not send tasks
  • Minimal Result Backend Client Version: Kombu 5.7.0a1 (in-memory cache)

Python Packages

Package inventory from uv pip freeze in a dedicated environment. The local editable Celery path is replaced with the tested commit URL.

pip freeze Output:

amqp==5.4.0
billiard==4.3.0
-e git+https://github.com/celery/celery.git@7b4edf4768262636645076226b4f5a28d5081c7a#egg=celery
click==8.5.0
click-didyoumean==0.3.1
click-plugins==1.1.1.2
click-repl==0.4.0
kombu==5.7.0a1
prompt-toolkit==3.0.53
python-dateutil==2.9.0.post0
six==1.17.0
typing-extensions==4.16.0
tzdata==2026.4
tzlocal==5.4.4
vine==5.1.0
wcwidth==0.8.4

Other Dependencies

No external services, worker, or other dependencies are needed.

Minimally Reproducible Test Case

Save this as reproduce.py and run python reproduce.py. It stores a failed task result in the in-memory backend and reads it through nested GroupResult objects, without mocks or a worker.

from celery import Celery, states
from uuid import uuid4

app = Celery('nested-propagate', broker='memory://', backend='cache+memory://')
task_id = str(uuid4())
app.backend.store_result(task_id, ValueError('failed'), states.FAILURE)
nested = app.GroupResult(str(uuid4()), [app.AsyncResult(task_id)])
result = app.GroupResult(str(uuid4()), [nested])
print(result.get(propagate=False))

Expected Behavior

With propagate=False, the failed child's exception should be returned in its position in the nested result:

[[ValueError('failed')]]

The same script returns this value with the fix in #10689.

Actual Behavior

The call raises ValueError: failed instead. Relevant traceback:

  File "celery/result.py", line 735, in get
    return (self.join_native if self.supports_native_join else self.join)(
  File "celery/result.py", line 874, in join_native
    value.append(children_result.get())
...
ValueError: failed

The nested branch calls children_result.get() without forwarding propagate, so the child uses its default of True.

GangEunzzang avatar Sep 22 '26 09:09 GangEunzzang