Skip to content

[PR] fix: cancel invalidated keepalive timers on credential rotation - #6739

Merged
ranxianglei merged 1 commit into
ranxianglei:masterfrom
Afloat16:2026-11-14_keepalive-rotated-timers
Nov 14, 2026
Merged

ranxianglei merged 1 commit into
ranxianglei:masterfrom
Afloat16:2026-11-14_keepalive-rotated-timers

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

Closes #6737.

Problem

When a successful request changes credentials, keepalive removes the previous snapshot from its registry. If the new request has no eligible cache breakpoint, the function returns before cancelling the previous cadence timer. That callback continues holding the dropped snapshot and its body until the old deadline, outside the registry's concurrency cap.

With a concurrent cap of one, 20 arm/rotate/ineligible-request cycles leave no registered entry but 20 pending callbacks. A one-hour tier retains those callbacks until its existing 3,240-second cadence. The existing ownership check already prevents them from sending the old credential.

Change

Invalidate rotated snapshots through the existing disarm operation so registry removal also cancels their timer. Unchanged credentials retain the existing prior-snapshot behavior. An eligible replacement still installs one new timer, and other sessions remain untouched.

Validation

  • Six new public-arm tests: five-minute and one-hour cancellation, 20 repeated rotations under a one-entry cap, another session's isolation, same-credential behavior, and a real HTTP ping from an eligible replacement with the new synthetic credential.
  • Unchanged master a8bbb8d23108ba9148d09512927041364625d910: 4 new regressions fail, 2 controls pass, and the existing 39 tests pass.
  • Fixed: 51 tests pass across keepalive and breakpoint-scope suites.
  • npm run typecheck, npm run build, and git diff --check pass. Full regression status is the remote CI result on this PR's head.

The retention evidence is pending callbacks holding entry references; this PR does not claim a measured heap-size reduction or old-credential transmission.

Prior work

The original #3390 contains the direct registry deletion. My complete #6078 and #6238 patches and their issues cover response ownership and breakpoint discovery. Timer-unref work #5672 concerns event-loop liveness. None cancels an invalidated snapshot at this early-return path. This is also separate from #6735's unreadable response-body handling.

@ranxianglei ranxianglei changed the title fix: cancel invalidated keepalive timers on credential rotation [PR] fix: cancel invalidated keepalive timers on credential rotation Nov 14, 2026
@ranxianglei
ranxianglei merged commit cb6637b into ranxianglei:master Nov 14, 2026
48 checks passed
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.

Rotating credentials can leave an unregistered keepalive snapshot held by its timer

2 participants