Close Session when there's failures to write to a Stream #143
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.
This pull request introduces a new test to detect a deadlock bug and includes modifications to handle connection write timeouts more robustly. The changes span across multiple files, with the primary focus on ensuring that sessions are closed properly when a write timeout occurs.
New Test for Deadlock Detection:
deadlock_test.go
: Added a comprehensive testTestTimeoutParallel
to simulate and detect a deadlock scenario in yamux streams. This test sets up two streams, stalls one to fill the channel, and verifies if the session closes correctly on write timeout.Improvements in Connection Write Timeout Handling:
session.go
: Enhanced thewaitForSendErr
andsendNoWait
functions to ensure that the session is properly closed when a connection write timeout or session shutdown occurs. The changes include:s.exitErr(err)
if an error occurs. [1] [2] [3] [4]Test Adjustments:
session_test.go
: Modified theTestSession_PingOfDeath
to handle the expectedErrSessionShutdown
error when a write times out, ensuring the test accounts for the new session shutdown behaviour.Closes #142.
I humbly request a callout in changelogs when this bugfix ships :)