Pin kombu to unreleased commit to fix worker hang after Redis connection reset - #3640
Pin kombu to unreleased commit to fix worker hang after Redis connection reset#3640jonathangreen wants to merge 2 commits into
Conversation
When a celery worker's redis broker connection is reset, kombu's redis transport timer callbacks raise ConnectionError through the event loop and stale timers accumulate across reconnect attempts, leaving the worker permanently unable to consume tasks (celery/celery#10205). The fix (celery/kombu#2498) is merged upstream but not yet in a kombu release, so pin kombu to the merge commit until a release containing it is published.
|
Claude finished @jonathangreen's task in 4m 43s —— View job Claude Code Review
SummaryThe pin is well-executed and the diagnosis in the description matches the code: DetailsMinor:
|
Greptile SummaryThis PR pins Kombu 5.6.2 to a commit-addressed upstream archive containing the Redis reconnection fix.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| pyproject.toml | Adds the documented direct Kombu dependency and commit-addressed URL source. |
| uv.lock | Locks Kombu to the selected archive and records its resolved dependency metadata and artifact hash. |
Reviews (2): Last reviewed commit: "Install pinned kombu from GitHub commit ..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3640 +/- ##
=======================================
Coverage 93.54% 93.54%
=======================================
Files 509 513 +4
Lines 46854 46883 +29
Branches 6406 6406
=======================================
+ Hits 43829 43859 +30
+ Misses 1955 1954 -1
Partials 1070 1070 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The docker images do not include a git executable, so uv cannot fetch a git source there. GitHub's commit archive tarball has the same content and uv downloads it over HTTPS with its own fetcher, no git required.
Description
Pins
kombuto an unreleased upstream commit (2c8372c, the merge commit of celery/kombu#2498) via a direct dependency and a[tool.uv.sources]entry pointing at GitHub's commit archive tarball. Using the tarball URL rather than a git source lets uv fetch it over plain HTTPS, so no git executable is needed in the docker images. kombu still identifies as 5.6.2 at this commit, so celery's own dependency constraint remains satisfied.This pin is a temporary bandaid: it should be removed once a kombu release containing the fix (5.7.0 milestone) is published. The comment in
pyproject.tomldocuments the removal condition.Motivation and Context
When a celery worker's Redis broker connection is reset (e.g. by a Redis failover or restart), the worker logs
consumer: Connection to broker lost. Trying to re-establish the connection...and then permanently stops consuming from all queues, while beat and already-running tasks continue. We hit this in production on 2026-08-11 (~10:54 UTC) onfl-florida-scriptsand at least one other instance; the only recovery is restarting the worker.This is celery/celery#10205: kombu's redis transport timer callbacks (
maybe_restore_messages,maybe_check_subclient_health) raiseConnectionErrorthrough the event loop while the connection is down, and each reconnect attempt registers new timers without cancelling the old ones, so stale timers accumulate and repeatedly crash the loop. The celery half of the fix (celery/celery#10218) is already in celery 5.6.3, which we run — our incident shows it is insufficient on its own. The kombu half (celery/kombu#2498) is merged but unreleased.Opened as a draft: we may prefer to wait for the kombu release. This PR is ready to merge if the hang recurs before that release ships.
How Has This Been Tested?
connection_errorsguards insidemaybe_restore_messages/maybe_check_subclient_health, and the timer references (_restore_messages_tref/_subclient_health_tref) that are cancelled on reconnect.tox -e py312-docker -- tests/manager/celery/ tests/manager/service/celery/— 445 passed.commonstage ofdocker/Dockerfilelocally (bothuv syncsteps succeed with no git in the image) and confirmed the installed kombu inside the image contains the fix.Checklist