Skip to content

fix: reject unfulfilled commands dropped on reconnect - #2194

Merged
PavelPashov merged 1 commit into
redis:mainfrom
ramin-010:fix/reject-dropped-unfulfilled-commands
Sep 14, 2026
Merged

PavelPashov merged 1 commit into
redis:mainfrom
ramin-010:fix/reject-dropped-unfulfilled-commands

Conversation

@ramin-010

@ramin-010 ramin-010 commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2193.

On close from ready, in-flight commands move to prevCommandQueue. A successful
reconnect replaces commandQueue, so with autoResendUnfulfilledCommands: false
the ready handler dropped the stash without rejecting it, and flushQueue only
walks offlineQueue and commandQueue — leaving those promises unsettleable, even
by disconnect().

Each stashed command is now rejected with abortError, as you suggested, so they
fail the same way as the other connection-drop paths.

Regression test added to the existing autoResendUnfulfilledCommands block in
test/functional/connection.ts: an in-flight BLPOP, a destroyed stream, and an
assertion that the promise rejects after reconnect. On main it times out at 8s;
with the change it passes in ~250ms.

On close from ready, in-flight commands are stashed in prevCommandQueue. A
successful reconnect replaces commandQueue, so when autoResendUnfulfilledCommands
is false the ready handler dropped the stash without rejecting it. flushQueue only
walks offlineQueue and commandQueue, so nothing could settle those promises
afterwards - not even disconnect().

Reject each stashed command with abortError, matching the other connection-drop
paths.

Closes redis#2193

@nkaradzhov nkaradzhov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the thorough issue and the fix, LGTM.
I would still defer the final decision to @PavelPashov

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.

Command promise never settles after reconnect when autoResendUnfulfilledCommands is false

3 participants