Skip to content

fix: handle socket errors during upgrade hooks - #381

Merged
Tony133 merged 1 commit into
fastify:mainfrom
Dansatch:fix-upgrade-socket-error
Oct 3, 2026
Merged

Tony133 merged 1 commit into
fastify:mainfrom
Dansatch:fix-upgrade-socket-error

Conversation

@Dansatch

Copy link
Copy Markdown
Contributor

Fixes #380

A client disconnecting while an asynchronous upgrade hook was still running could crash the whole server.

This change handles socket errors during that short window, then lets ws take over error handling once the upgrade begins.

A regression test that reproduces the disconnect and confirms the server stays running has been added.

Checklist

Signed-off-by: dansatch <dansatch98@gmail.com>

@Tony133 Tony133 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@Tony133
Tony133 merged commit 5adf931 into fastify:main Oct 3, 2026
17 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.

Unhandled 'error' on the raw socket crashes the process when a client resets during upgrade hooks

2 participants