Skip to content

Stop reading frames after a dropped PONG ended the socket - #1972

Merged
uNetworkingAB merged 1 commit into
uNetworking:masterfrom
nigrosimone:pong-dropped-end
Nov 21, 2026
Merged

uNetworkingAB merged 1 commit into
uNetworking:masterfrom
nigrosimone:pong-dropped-end

Conversation

@nigrosimone

Copy link
Copy Markdown
Contributor

With a dropped handler that calls ws->end(), a client that floods PINGs and never reads gets dropped called again after close. The PONG goes over maxBackpressure, dropped ends the socket and close is emitted, but the PING branch checks isShuttingDown only after a ping handler, so the loop keeps parsing frames and dropping PONGs. In uWebSockets.js this is a segfault, the JS object is gone after close.

The fix adds the same check right after the PONG, in the two PING branches.

The new test floods PINGs and counts dropped calls after close: 3720 without the fix, 0 with it.

@nigrosimone
nigrosimone marked this pull request as ready for review November 21, 2026 10:01
@uNetworkingAB
uNetworkingAB merged commit c3b7d76 into uNetworking:master Nov 21, 2026
2 checks passed
@uNetworkingAB

Copy link
Copy Markdown
Contributor

Smart 👍

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