Skip to content

fix(client): stop reconnecting after callback shutdown - #3531

Merged
nkaradzhov merged 1 commit into
redis:masterfrom
jakobzach:jakob/fix-shutdown-in-reconnecting
Oct 30, 2026
Merged

nkaradzhov merged 1 commit into
redis:masterfrom
jakobzach:jakob/fix-shutdown-in-reconnecting

Conversation

@jakobzach

@jakobzach jakobzach commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Description

Follow-up to #3499 and the ChatGPT/Codex finding.

If a reconnecting callback destroys the client or closes it with an empty queue, the socket currently starts another connection after the callback returns. That attempt captures the already-incremented teardown epoch and can revive the closed client.

Snapshot the teardown epoch before emitting reconnecting and stop if the callback changed it. Graceful close() with queued commands still connects and drains normally.

@nkaradzhov this uses the small post-callback check proposed in the previous review thread. The production change is two lines.

Validation

  • Both new public-client regressions (destroy() and empty-queue close() inside reconnecting) fail on unmodified upstream 1fd0e5f83a and pass with the fix.
  • Extended the existing queued-close regression to run inside the callback and preserve draining.
  • 30 focused socket/close tests, build, client type tests and changed-file lint pass.
  • Full npm test was attempted on Node 22.23.2 with Docker Desktop. Stopped after three container-readiness hooks timed out: Redis answered PING inside its container, but host connections to the test port were refused on both IPv4 and IPv6. The harness uses --network host; full-suite validation remains blocked by local Docker networking.
  • The focused run excludes Docker-backed tests and the existing retry-counter test.

Checklist

  • Does npm test pass with this change (including linting)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)? (No public API change.)

@nkaradzhov nkaradzhov left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@jakobzach thanks, somehow i missed the previous comment. LGTM

@nkaradzhov

Copy link
Copy Markdown
Collaborator

Should we merge this?

@jakobzach
jakobzach marked this pull request as ready for review October 30, 2026 14:16
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-30T14:17:45.408468Z
We couldn’t complete this review. Comment @codex review to try again.
d8b1a2f Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@nkaradzhov
nkaradzhov merged commit 72f8b9f into redis:master Oct 30, 2026
24 of 25 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.

2 participants