-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix IndexError on failure to close socket #114
base: main
Are you sure you want to change the base?
Conversation
It is possible for `loop.sock_connect` to fail in such a way that the wrapped socket no longer refers to a valid file descriptor. In this, the exception handler can fail on the attempt to call `sock.close()`. When this happens, `start_connection` can have `sock == None` and `exceptions == []`. This causes an `IndexError` because it assumes that `exceptions` always contains at least one exception instance.
Fix for type checker
Would you please post the full trace you get when it raises I'll try to get the code coverage reporting fixed |
I bumped the codecov-action in #115 so hopefully codecov will work again once this PR has tests added |
codecov reporting should work now if you update with main |
Ah yes, I believe this is the same issue. This started happening to us in production and the closest I have been able to come to a standalone test case is to generate statistically similar traffic patterns (which in our case means fairly aggressive timeouts). I haven't been able yet to craft a self-contained unit test. |
chore: bump codecov-action to 5.0.3 (aio-libs#115)
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #114 +/- ##
===========================================
- Coverage 100.00% 97.44% -2.56%
===========================================
Files 5 5
Lines 227 235 +8
Branches 60 60
===========================================
+ Hits 227 229 +2
- Misses 0 6 +6 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
What do these changes do?
It is possible for
loop.sock_connect
to fail in such a way that the wrapped socket no longer refers to a valid file descriptor. In this, the exception handler can fail on the attempt to callsock.close()
. When this happens,start_connection
can havesock == None
andexceptions == []
. This causes anIndexError
because it assumes thatexceptions
always contains at least one exception instance.Are there changes in behavior for the user?
I experienced crashes when handling connections with short timeouts.
Related issue number
Checklist