Skip to content

fix(concurrency): preserve shared Redis leases during startup - #8685

Open
GreyDGL wants to merge 2 commits into
Wei-Shaw:mainfrom
GreyDGL:codex/fix-shared-redis-startup
Open

GreyDGL wants to merge 2 commits into
Wei-Shaw:mainfrom
GreyDGL:codex/fix-shared-redis-startup

Conversation

@GreyDGL

@GreyDGL GreyDGL commented Nov 11, 2026

Copy link
Copy Markdown

Starting a replica currently removes other processes' account/user concurrency slots and shared wait counters. Their requests keep running without being counted, so a restart or scale-out can exceed configured limits.

This change reuses Redis-time lease expiry for startup cleanup, preserves unexpired peer leases and waiter TTLs, and atomically bounds nonexpiring legacy counters. Valid index candidates are left for the existing background reconciler so startup cannot erase a concurrent peer registration.

This is a smaller, lease-based alternative to #7804, with no process heartbeat or hostname assumptions. It preserves heartbeat-less peers when the new binary starts; an old binary's destructive startup behavior still requires upgrading that binary. Crashed slots remain until their normal lease expiry, and ownerless shared counters retain their existing TTL/residue limitations.

Validation:

  • New startup regressions fail on unchanged main and pass with this change, including first/subsequent starts, Redis clock/expiry boundaries, waiter TTL preservation and concurrent index registration.
  • Repository default and unit-tagged tests pass.
  • 32 selected concurrency service unit tests pass.
  • Existing ConcurrencyCacheSuite passes against disposable Redis 8.4 and PostgreSQL 18.1; its existing load-batch TODO remains skipped.
  • gofmt, git diff --check and Gitleaks pass.

No new dependencies or schema changes. A multi-node Redis Cluster and older Redis versions were not separately exercised; the added Lua scripts each touch only one key.

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Before we can merge this PR, we need you to sign our Contributor License Agreement (CLA).

To sign, please reply with the following comment:

I have read the CLA Document and I hereby sign the CLA

You only need to sign once — it will be valid for all your future contributions to this project.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

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.

1 participant