Skip to content

fix(redis): defer re-entrant cancel_for to avoid GC-driven pub/sub deadlock - #10326

Closed
wckao wants to merge 21 commits into
celery:mainfrom
wckao:fix/redis-pubsub-gc-deadlock
Closed

wckao wants to merge 21 commits into
celery:mainfrom
wckao:fix/redis-pubsub-gc-deadlock

Conversation

@wckao

@wckao wckao commented May 23, 2026

Copy link
Copy Markdown

Summary

Fixes a re-entrant Redis pub/sub deadlock in the result backend. CPython's cyclic GC can fire AsyncResult.__del__ mid-SUBSCRIBE/UNSUBSCRIBE, which calls back into cancel_for on the same shared PubSub connection and wedges the Redis protocol on interleaved responses. We've observed this in production as chain.apply_async() calls hanging indefinitely (tens of occurrences per day across our worker fleet, with workers stuck for hours).

  • celery/backends/redis.py — ResultConsumer now uses a threading.local depth counter. Nested cancel_for calls (the inner UNSUBSCRIBE in both stacks below) are queued and drained after the outer subscribe/unsubscribe returns. The drain loop holds depth=1 so finalizers fired during drain also queue rather than re-enter the connection.
  • t/unit/backends/test_redis.py — three regression tests:
    • test_cancel_for_reentry_during_subscribe (Stack A: GC inside chain.apply_async() → subscribe)
    • test_cancel_for_reentry_during_unsubscribe (Stack B: GC inside task body → outer unsubscribe)
    • test_drain_deferred_handles_nested_reentry (re-entries fired during the deferred drain are also queued)

Bug detail

Two pieces of code are individually correct but mutually unsafe:

  1. BaseAsynchronousBackend.add_pending_result issues SUBSCRIBE on a single shared PubSub connection.
  2. AsyncResult.__del__ calls backend.remove_pending_result → cancel_for → UNSUBSCRIBE on the same PubSub.

When CPython's cyclic GC finalizes a lingering AsyncResult cycle during the SUBSCRIBE/UNSUBSCRIBE response wait, the finalizer re-enters the same connection. The protocol is single-RPC-at-a-time; the connection deadlocks.

Production py-spy stack A — GC during chain.apply_async()

execute_command (redis/client.py)        <- TOP: UNSUBSCRIBE blocked
unsubscribe (redis/client.py)
cancel_for (celery/backends/redis.py)
on_result_fulfilled (celery/backends/asynchronous.py)
remove_pending_result (celery/backends/asynchronous.py)
__del__ (celery/result.py)               <- GC-triggered finalizer
execute_command (redis/client.py)        <- outer SUBSCRIBE still pending
subscribe (redis/client.py)
_consume_from (celery/backends/redis.py)
add_pending_result (celery/backends/asynchronous.py)
freeze (celery/canvas.py)
apply_async (celery/canvas.py)

Production py-spy stack B — GC inside task body (after deploying a downstream apply_async-only mitigation)

execute_command (redis/client.py)        <- TOP: inner UNSUBSCRIBE blocked
unsubscribe (redis/client.py)            <- INNER
cancel_for (celery/backends/redis.py)
__del__ (celery/result.py)               <- INNER finalizer
call_with_retry (redis/retry.py)
execute_command (redis/client.py)        <- OUTER UNSUBSCRIBE still pending
unsubscribe (redis/client.py)            <- OUTER
cancel_for (celery/backends/redis.py)
__del__ (celery/result.py)               <- OUTER finalizer
<task body or any code that drops an AsyncResult>

Both stacks share the same root cause — re-entrant pub/sub on a shared connection. A fix scoped to apply_async alone (e.g. disabling cyclic GC around it) closes A but leaves B. The depth-guard at the ResultConsumer layer closes both.

Reproduction

The script (linked + inlined below) supports two modes matching the two production stacks. Both deadlock within ~10 s on unpatched celery; both complete in milliseconds with this PR applied.

# Stack A — GC fires during SUBSCRIBE (inside chain.apply_async)
REPRO_MODE=subscribe python reproduce_celery_redis_gc_deadlock.py

# Stack B — GC fires during UNSUBSCRIBE (from a __del__ in the task body)
REPRO_MODE=unsubscribe python reproduce_celery_redis_gc_deadlock.py

Reproduction script: https://gist.github.com/wckao/a292b29baceae14b911da2e54e3d2730

Inline copy for review convenience:

reproduce_celery_redis_gc_deadlock.py
"""Minimal, self-contained reproduction of two distinct code paths that
trigger the same Celery Redis result-backend re-entrant pub/sub
deadlock. The root cause in both cases is the same: a single shared
PubSub connection cannot safely process a nested command issued from
AsyncResult.__del__ while the outer command is still mid-flight.

This script has no dependency on any application code — it only needs
celery, redis-py, and a reachable broker + Redis result backend.

# Requirements
    pip install "celery[redis]" "redis"
    A running broker (any kombu-supported, e.g. RabbitMQ or Redis)
    A running Redis instance to use as the result backend

# Two reproducible modes

  REPRO_MODE=subscribe (default) — "Stack A"
      chain.apply_async() → freeze() → add_pending_result() →
      subscribe() sends SUBSCRIBE. Before the ACK is read, cyclic GC
      fires AsyncResult.__del__ on an unreachable cycle, which calls
      cancel_for → unsubscribe → execute_command UNSUBSCRIBE on the
      SAME PubSub connection. The inner UNSUBSCRIBE blocks reading a
      response intended for the outer SUBSCRIBE.

  REPRO_MODE=unsubscribe — "Stack B"
      An outer __del__ fires from the task body (not apply_async),
      entering cancel_for → unsubscribe → execute_command. Before the
      UNSUBSCRIBE response is read, a SECOND __del__ fires (in
      production via cyclic GC inside redis-py's call_with_retry; here
      we simulate via direct __del__ invocation). That second __del__
      calls cancel_for → unsubscribe → execute_command on the SAME
      connection that's mid-UNSUBSCRIBE. Nested commands wedge the
      protocol identically to Stack A.

# Usage

    # Default: Stack A (subscribe re-entry)
    python reproduce_celery_redis_gc_deadlock.py

    # Stack B (unsubscribe re-entry)
    REPRO_MODE=unsubscribe python reproduce_celery_redis_gc_deadlock.py

    # Custom broker / backend URLs:
    BROKER_URL=amqp://guest:guest@localhost:5672// \
    RESULT_BACKEND=redis://localhost:6379/2 \
    REPRO_MODE=unsubscribe python reproduce_celery_redis_gc_deadlock.py

# Outcome

    Both modes deadlock within ~10 s with the bug present. A watchdog
    thread aborts the process with exit code 2 after WATCHDOG_S
    seconds and prints the mode-specific production fingerprint.

    With a sufficient upstream fix (or our downstream re-entry guard
    that wraps ResultConsumer._consume_from / cancel_for with a
    thread-local depth counter), both modes complete in milliseconds.

# Why two modes

    Stack A was the first observation; a targeted mitigation that
    disables cyclic GC during chain.apply_async() suffices to close it.
    Stack B emerged AFTER that mitigation was deployed in production —
    the same race fires when __del__ runs anywhere else (e.g. inside
    the task body during a DB query or kombu call). Both stacks are
    closed by deferring the inner cancel_for at the result-backend
    layer; the apply_async-scoped fix alone is insufficient.

# Versions reproduced on
    celery 5.6.3 / kombu 5.6.2 / redis-py 5.3.1 / billiard 4.2.4 /
    Python 3.13.0 / Ubuntu 24.04. Also expected on 5.5.x and earlier.
"""

from __future__ import annotations

import gc
import os
import sys
import threading
import time

from celery import Celery, chain

# ---------------------------------------------------------------------------
# Config
# ---------------------------------------------------------------------------
REPRO_MODE = os.environ.get("REPRO_MODE", "subscribe").lower()
BROKER_URL = os.environ.get("BROKER_URL", "redis://localhost:6379/0")
RESULT_BACKEND = os.environ.get("RESULT_BACKEND", "redis://localhost:6379/0")
WATCHDOG_S = float(os.environ.get("WATCHDOG_S", "10"))

if REPRO_MODE not in {"subscribe", "unsubscribe"}:
    sys.exit(
        f"REPRO_MODE must be 'subscribe' or 'unsubscribe' (got {REPRO_MODE!r})"
    )

print(f"mode:    {REPRO_MODE}")
print(f"broker:  {BROKER_URL}")
print(f"backend: {RESULT_BACKEND}")
print(f"watchdog timeout: {WATCHDOG_S:.0f}s")
print()

app = Celery("repro", broker=BROKER_URL, backend=RESULT_BACKEND)


@app.task
def noop(x: int) -> int:
    return x


# ---------------------------------------------------------------------------
# Watchdog — aborts the process if the main thread is still blocked after
# WATCHDOG_S, printing the mode-specific production fingerprint.
# ---------------------------------------------------------------------------
done = threading.Event()


def _watchdog() -> None:
    if done.wait(WATCHDOG_S):
        return
    sys.stderr.write(
        f"
!!! DEADLOCK DETECTED — main thread did not return within {WATCHDOG_S:.0f}s !!!
"
    )
    stack_label = "A (subscribe re-entry)" if REPRO_MODE == "subscribe" else "B (unsubscribe re-entry)"
    sys.stderr.write(f"This matches the production py-spy fingerprint for Stack {stack_label}:
")
    if REPRO_MODE == "subscribe":
        sys.stderr.write("    execute_command (redis/client.py)        <- TOP: UNSUBSCRIBE blocked
")
        sys.stderr.write("    unsubscribe (redis/client.py)
")
        sys.stderr.write("    cancel_for (celery/backends/redis.py)
")
        sys.stderr.write("    on_result_fulfilled (celery/backends/asynchronous.py)
")
        sys.stderr.write("    remove_pending_result (celery/backends/asynchronous.py)
")
        sys.stderr.write("    __del__ (celery/result.py)               <- GC-triggered finalizer
")
        sys.stderr.write("    execute_command (redis/client.py)        <- outer SUBSCRIBE still pending
")
        sys.stderr.write("    subscribe (redis/client.py)
")
        sys.stderr.write("    _consume_from (celery/backends/redis.py)
")
        sys.stderr.write("    add_pending_result (celery/backends/asynchronous.py)
")
        sys.stderr.write("    then (celery/result.py)
")
        sys.stderr.write("    freeze (celery/canvas.py)
")
        sys.stderr.write("    apply_async (celery/canvas.py)           <- entry point
")
    else:  # unsubscribe
        sys.stderr.write("    execute_command (redis/client.py)        <- TOP: inner UNSUBSCRIBE blocked
")
        sys.stderr.write("    unsubscribe (redis/client.py)            <- INNER
")
        sys.stderr.write("    cancel_for (celery/backends/redis.py)
")
        sys.stderr.write("    remove_pending_result (celery/backends/asynchronous.py)
")
        sys.stderr.write("    __del__ (celery/result.py)               <- INNER finalizer (nested)
")
        sys.stderr.write("    call_with_retry (redis/retry.py)
")
        sys.stderr.write("    _execute (redis/client.py)
")
        sys.stderr.write("    execute_command (redis/client.py)        <- OUTER UNSUBSCRIBE still pending
")
        sys.stderr.write("    unsubscribe (redis/client.py)            <- OUTER
")
        sys.stderr.write("    cancel_for (celery/backends/redis.py)
")
        sys.stderr.write("    remove_pending_result (celery/backends/asynchronous.py)
")
        sys.stderr.write("    __del__ (celery/result.py)               <- OUTER finalizer
")
        sys.stderr.write("    <task body or any code that drops an AsyncResult>
")
    sys.stderr.flush()
    os._exit(2)


threading.Thread(target=_watchdog, daemon=True).start()


# ---------------------------------------------------------------------------
# Mode-specific reproduction
# ---------------------------------------------------------------------------
import redis.connection  # noqa: E402

orig_send = redis.connection.Connection.send_packed_command


# ===========================================================================
# Stack A — GC fires during SUBSCRIBE (inside chain.apply_async)
# ===========================================================================
if REPRO_MODE == "subscribe":
    print("Setting up Stack A: pending AsyncResult cycles to be finalized mid-SUBSCRIBE...")

    pre_chains = [chain(noop.si(i), noop.si(i + 1)) for i in range(3)]
    pre_results = [c.apply_async() for c in pre_chains]

    class CycleHolder:
        def __init__(self, ar: object) -> None:
            self.ar = ar
            self.self_ref = self  # cycle: only cyclic GC can reclaim

    _holders: list | None = [CycleHolder(r) for r in pre_results]
    del pre_results
    del pre_chains

    triggered_a = [False]

    def _send_a(self, command, check_health=True):  # type: ignore[no-untyped-def]
        result = orig_send(self, command, check_health=check_health)
        if triggered_a[0]:
            return result
        first = command[0] if isinstance(command, list) and command else command
        if isinstance(first, (bytes, bytearray, memoryview)) and b"SUBSCRIBE" in bytes(first):
            triggered_a[0] = True
            global _holders
            _holders = None
            if gc.isenabled():
                # Simulate automatic cyclic-GC firing inside the SUBSCRIBE wait.
                gc.collect()
            else:
                print("(gc.isenabled() is False — would skip natural cyclic-GC here)")
        return result

    redis.connection.Connection.send_packed_command = _send_a

    print("Dispatching new chain via apply_async() ...")
    t0 = time.time()
    new_chain = chain(noop.si(100), noop.si(200))
    result = new_chain.apply_async()
    elapsed = time.time() - t0
    done.set()

    print(f"
SUCCESS: apply_async returned in {elapsed:.3f}s, id={result.id}")
    print(f"triggered={triggered_a[0]}")
    print("Bug was NOT reproduced — celery is patched OR cyclic-GC was disabled.")


# ===========================================================================
# Stack B — outer __del__ in cancel_for is re-entered by inner __del__
# ===========================================================================
else:  # REPRO_MODE == "unsubscribe"
    print("Setting up Stack B: two AsyncResults, both __del__ to be invoked sequentially...")

    # Two pending AsyncResults whose channels are subscribed on the same
    # shared PubSub. We invoke their __del__ methods directly so we don't
    # depend on cyclic-GC re-entrancy semantics (gc.collect() is not
    # reentrant — calling it from inside __del__ is a no-op). Direct
    # invocation precisely mirrors the production stack where two
    # nested __del__ frames appear on the main thread.

    outer_result = chain(noop.si(1000), noop.si(1001)).apply_async()
    inner_result = chain(noop.si(2000), noop.si(2001)).apply_async()

    triggered_b = [False]

    def _send_b(self, command, check_health=True):  # type: ignore[no-untyped-def]
        result = orig_send(self, command, check_health=check_health)
        if triggered_b[0]:
            return result
        first = command[0] if isinstance(command, list) and command else command
        if isinstance(first, (bytes, bytearray, memoryview)) and b"UNSUBSCRIBE" in bytes(first):
            triggered_b[0] = True
            # Inner __del__ fires inside the outer's send → __del__ runs
            # cancel_for → unsubscribe → execute_command on the SAME
            # PubSub connection that's still mid-outer-UNSUBSCRIBE.
            # Mirrors production: GC inside redis-py's call_with_retry
            # finalizing another AsyncResult cycle while an outer
            # cancel_for is mid-flight.
            inner_result.__del__()
        return result

    redis.connection.Connection.send_packed_command = _send_b

    print("Invoking outer AsyncResult.__del__() ...")
    t0 = time.time()
    outer_result.__del__()
    elapsed = time.time() - t0
    done.set()

    print(f"
SUCCESS: outer __del__() returned in {elapsed:.3f}s")
    print(f"triggered={triggered_b[0]}")
    print("Bug was NOT reproduced — celery is patched OR the re-entry guard is active.")

sys.exit(0)

Affected versions

  • celery 5.6.3 (likely also 5.5.x and earlier — the involved code paths have existed since at least 5.0)
  • kombu 5.6.2
  • redis-py 5.3.1
  • Python 3.13.0

Any setup that uses the Redis result backend and dispatches chain / group / chord apply_async() under allocation pressure.

Test plan

  • t/unit/backends/test_redis.py::test_RedisResultConsumer — all 14 tests pass (11 existing + 3 new regression tests)
  • t/unit/backends/ — full suite passes (1 unrelated msgpack-missing failure in my local env)
  • CI runs the full unit + integration matrix
  • Production: downstream version of this guard has been live across our worker fleet; both stacks A and B no longer appear in py-spy dumps

…adlock

Cyclic GC can finalize an AsyncResult mid-SUBSCRIBE/UNSUBSCRIBE via
AsyncResult.__del__ -> backend.remove_pending_result -> cancel_for,
which re-enters the same shared PubSub connection and wedges the
Redis protocol waiting for interleaved responses. Production stacks
show this on chain.apply_async() (outer SUBSCRIBE) and on task-body
finalizers (outer UNSUBSCRIBE).

Add a thread-local depth guard to ResultConsumer: nested cancel_for
calls are queued and drained after the outer subscribe/unsubscribe
completes. The drain loop holds depth=1 so finalizers fired during
drain also queue rather than re-enter the connection.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@auvipy

auvipy commented May 24, 2026

Copy link
Copy Markdown
Member

can you please refer to any relevant issues for more context?

@codecov

codecov Bot commented May 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.51020% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.25%. Comparing base (7b4edf4) to head (53172b4).

Files with missing lines Patch % Lines
celery/backends/redis.py 75.51% 10 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10326      +/-   ##
==========================================
- Coverage   89.28%   89.25%   -0.04%     
==========================================
  Files         153      153              
  Lines       20397    20441      +44     
  Branches     2431     2436       +5     
==========================================
+ Hits        18212    18245      +33     
- Misses       1881     1891      +10     
- Partials      304      305       +1     
Flag Coverage Δ
unittests 89.23% <75.51%> (-0.04%) ⬇️

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.

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

Fixes a Redis result-backend deadlock caused by re-entrant pub/sub usage (e.g., AsyncResult.__del__ triggering cancel_for() while a SUBSCRIBE/UNSUBSCRIBE is in-flight) by deferring nested cancel_for() calls and draining them once the outer operation completes.

Changes:

  • Add a re-entrancy guard to celery.backends.redis.ResultConsumer using a per-thread depth counter and a deferred-cancel queue.
  • Defer nested cancel_for() calls during subscribe/unsubscribe and drain them safely after the outer operation finishes.
  • Add three unit regression tests covering re-entry during subscribe, unsubscribe, and during the deferred-drain loop itself.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
celery/backends/redis.py Adds depth-tracked deferral + drain mechanism to avoid re-entrant pub/sub deadlocks.
t/unit/backends/test_redis.py Adds regression tests exercising re-entrant cancel_for() scenarios and drain behavior.

Comment thread celery/backends/redis.py Resolved

@auvipy auvipy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please check the test failures

Wei-Chun Kao and others added 2 commits May 25, 2026 21:42
The earlier Copilot autofix removed the ``finally`` clause while
keeping an outer ``try`` with no handler, producing a SyntaxError
and breaking unit-test collection across the suite.

Restore the ``finally: self._reentry.depth = 0`` so depth is reset
even when the inner ``raise RuntimeError`` propagates, and keep the
RuntimeError re-raise so unrecoverable backend errors aren't
swallowed.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
A single matrix cell (test_tasks.py / 3.12 / rabbitmq_redis) hit
``ValueError: bad marshal data (invalid reference)`` while pydantic
loaded ``_internal/_generate_schema.py`` -- a corrupted .pyc on the
runner, unrelated to the changes in this PR. All other ~24 matrix
cells of the same module passed.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@wckao

wckao commented May 25, 2026 •

Copy link
Copy Markdown
Author

Thanks for the review. We triaged this directly from production py-spy stacks, so there's no existing GitHub issue.

Two angles worth distinguishing:

The deadlock trigger is chain construction itself, independent of any timeout. chain.apply_async() → freeze() → add_pending_result() → subscribe() issues a SUBSCRIBE on the shared PubSub. freeze() allocates many short-lived objects, which pushes CPython's GC counter past gc.get_threshold() during the SUBSCRIBE response wait. If there's a lingering AsyncResult cycle from an earlier chain (these form naturally via backend._pending_results ↔ vine Promise.then callbacks), cyclic GC fires AsyncResult.__del__ → cancel_for → UNSUBSCRIBE on the same connection mid-flight, and the Redis protocol wedges. Minimal repro is just back-to-back chain.apply_async() calls under allocation pressure — our reproduce_celery_redis_gc_deadlock.py Stack A mode demonstrates this deterministically in ~10 s on no-op chains.

The production blast radius is amplified by soft_time_limit without a hard_time_limit. Once a worker hits the wedged connection it stops making progress, but soft-only timeouts don't kill the task — it doesn't fail, doesn't retry, and keeps holding its Redis result-backend connection. At our chain dispatch rate (~10–100 chains/s per worker), wedged workers accumulate until they exhaust Redis's maxclients budget. We were seeing ~30–60 stuck workers per day across our pod fleet, each idle for hours, before tracing it to GC-fired AsyncResult.__del__ re-entering pub/sub mid-flight.

Full root-cause analysis, both production py-spy stacks (A: GC during chain.apply_async() SUBSCRIBE; B: GC during a task-body UNSUBSCRIBE), and the deterministic reproduction script are in the PR description and gist. Happy to file a tracking issue if you'd prefer a separate discoverable artifact — just let me know.

@wckao

wckao commented May 25, 2026

Copy link
Copy Markdown
Author

Copilot's except Exception catching RuntimeError(E_RETRY_LIMIT_EXCEEDED) — valid, agreed. Addressed by autofix a46f84e34 (adds except RuntimeError: raise), but that autofix also dropped the finally: clause, leaving the outer try: handler-less. The resulting SyntaxError broke import of celery.backends.redis and cascaded into the collection-level failures across test_backends, test_preload_cli, test_RedisResultConsumer::* (the 0.003s-runtime tests). Fixed in 5b3462392: restored finally: self._reentry.depth = 0, kept except RuntimeError: raise.

Only remaining red is Integration-tests (test_tasks.py) / 3.12 / rabbitmq_redis — bad marshal data inside pydantic's own _internal/_generate_schema.py. 1 of ~25 matrix cells hit it (other brokers on same Python and same broker on other Pythons all passed), so it's runner-side .pyc corruption, unrelated. Pushed c7917c001 (empty) to retrigger.

Codecov flags 6 new lines (the drain's except Exception + logger.exception) as uncovered — can add a test simulating a failing inner _cancel_for if patch coverage matters.

@wckao
wckao requested a review from auvipy May 25, 2026 21:05
@auvipy auvipy added this to the 5.7.0 milestone May 26, 2026

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread celery/backends/redis.py Resolved
Comment thread celery/backends/redis.py Resolved
auvipy and others added 4 commits June 3, 2026 14:31
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Apply the same try/log/raise wrapper around `_drain_deferred_cancels`
in both `_consume_from` and `cancel_for`. Logging gives a debug
breadcrumb when the drain fails (addressing Copilot's masking concern);
re-raising preserves `RuntimeError(E_RETRY_LIMIT_EXCEEDED)` as the
unrecoverable-backend signal that prompts an operator restart. Python
chains any outer exception via `__context__`.

Drops the `exc = None` capture in `cancel_for` -- the inline `try/except`
in the `finally:` block handles both the original-success and
original-failure cases uniformly.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

@auvipy auvipy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it would be nice to improve test coverage, and possibly some integration/smoke tests for this

@auvipy auvipy modified the milestones: 5.7.0, 5.8.0 Aug 26, 2026
@auvipy

auvipy commented Sep 2, 2026

Copy link
Copy Markdown
Member

also the merge conflicts

@auvipy

auvipy commented Sep 2, 2026

Copy link
Copy Markdown
Member

i tried to fix the merge conflicts

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.

🔵 Needs a closer look

The low-level GC and Redis concurrency behavior needs human validation, including the uncovered drain failure paths.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread celery/backends/redis.py
Comment on lines +276 to +280
except RuntimeError:
# Unrecoverable backend state -- propagate so the
# caller can restart Celery. ``finally`` below
# still resets the depth counter.
raise

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@wckao can you please cross check this?

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