Skip to content

Redis: refresh binding deadline without ZADD GT (#2819) - #2820

Open
thelastbackspace wants to merge 2 commits into
celery:mainfrom
thelastbackspace:fix/2819-refresh-binding-zadd-gt
Open

thelastbackspace wants to merge 2 commits into
celery:mainfrom
thelastbackspace:fix/2819-refresh-binding-zadd-gt

Conversation

@thelastbackspace

Copy link
Copy Markdown

Summary

Since 5.7.0 the REFRESH_BINDING Lua script calls ZADD ... GT. GT only exists from Redis 6.2, so on 6.0 (still what Azure Cache for Redis runs) the script fails with ERR syntax error and any consumer of an x-expires queue breaks, e.g. the Celery pidbox queue at worker startup.

Fix

I replaced the GT flag with a ZSCORE + compare in the script, so the deadline is still only ever raised, never lowered. Works on any Redis with scripting.

Testing

Added unit tests that run the real script through lupa against a stub of the Redis 6.0 commands (ZADD rejects flags). They fail on main with ERR syntax error and pass with the fix, and also check a later deadline is not lowered. I added lupa to requirements/test.txt so they don't just skip in CI; happy to drop that and mark them skip-if-missing if you'd rather not add a test dep.

pytest t/unit/transport/test_redis.py -k refresh_binding

Fixes #2819

ZADD GT needs Redis 6.2, so REFRESH_BINDING failed with a syntax error
on Redis 6.0 and broke every consumer of an x-expires queue. Compare
against the current score in Lua instead.
@auvipy
auvipy self-requested a review November 10, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redis transport: REFRESH_BINDING script uses ZADD GT, fails on Redis < 6.2 (kombu 5.7.0)

2 participants