Fixed Python TcpipSocketStream write loop locking up on unhandled socket errors#2865
Merged
mcosgriff merged 2 commits intoFeb 24, 2026
Conversation
…IN/EWOULDBLOCK, the exception was silently swallowed and the while True loop would spin indefinitely, requiring a manual microservice restart to recover. Add an else: raise to propagate the original OSError immediately, matching the Ruby implementation which naturally bubbles up any exception not explicitly rescued. Also port the previously commented-out Ruby write tests to Python and add a regression test for the lock-up scenario. Suppress a valkey internal DeprecationWarning in the test suite that is not actionable from our code.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2865 +/- ##
==========================================
+ Coverage 78.72% 78.74% +0.01%
==========================================
Files 667 667
Lines 54496 54497 +1
Branches 731 731
==========================================
+ Hits 42904 42913 +9
+ Misses 11512 11504 -8
Partials 80 80
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…subclass of OSError in Python, so the interface's exception handling will still catch it and trigger a reconnect
|
jmthomas
approved these changes
Feb 24, 2026
jmthomas
pushed a commit
that referenced
this pull request
Mar 21, 2026
…ket errors (#2865) * When the write socket raised an OSError with an error other than EAGAIN/EWOULDBLOCK, the exception was silently swallowed and the while True loop would spin indefinitely, requiring a manual microservice restart to recover. Add an else: raise to propagate the original OSError immediately, matching the Ruby implementation which naturally bubbles up any exception not explicitly rescued. Also port the previously commented-out Ruby write tests to Python and add a regression test for the lock-up scenario. Suppress a valkey internal DeprecationWarning in the test suite that is not actionable from our code. * Raise a TimeoutError instead of RuntimeError. TimeoutError is also a subclass of OSError in Python, so the interface's exception handling will still catch it and trigger a reconnect
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.



TcpipSocketStream.write()where anOSErrorwith an error number other thanEAGAIN/EWOULDBLOCK(e.g.ECONNRESET,EPIPE) was silently swallowed, causing the interface to lock up indefinitely with no way to recover short of manually restarting the microserviceelse: raiseto re-raise the originalOSErrorimmediately, matching the behavior of the Ruby implementation which only rescuesEAGAIN/EWOULDBLOCKand lets all other errors bubble up naturallyFixes #2856