A pong waits no longer than the read's deadline - #121
Merged
Merged
Conversation
A ping was answered with a write that had no bound. A relay that sent pings and had stopped reading filled the socket, and the pong waited for room that never came, holding the write lock and with it the read, past any deadline. With a deadline, the pong is skipped when another write holds the lock or when the socket has no room before the deadline, checked with a wait that writes nothing. With no deadline, a ping is answered as before. Closes #118.
Carries the pong fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #118.
A ping was answered with a write that had no bound. A relay that sent pings and had stopped reading filled the socket, so the pong waited for room that never came while holding the connection's write lock. That held the read past any deadline, and any other write on the connection behind it.
With a deadline, the pong is now skipped when another write holds the lock, or when the socket has no room before the deadline. The room check is a
pollfor writability onIoStreamthat writes nothing, the same shape as the read deadline's peek. A pong frame is far below the kernel's low-water mark, so a socket that reports room takes it whole. Skipping is harmless: a peer that is not reading would not read it, and RFC 6455 lets an endpoint answer only the latest of several pings. With no deadline, a ping is answered as before.Tests
with a deadline, a pong is skipped rather than waited on when the peer has no room: a stream with no room; the read returns the next message and nothing is written. Without the room check it fails.with a deadline, a pong is skipped rather than queued behind another write: the write lock held by someone else; same expectation. Without the lock check the test hangs on the held lock.with a deadline and room to write, a ping is still answered.All 217 tests pass.
Release
The last commit bumps the version to 0.14.7.