python-trio / trio-websocket

WebSocket client and server implementation for Python Trio
MIT License
70 stars 25 forks source link

Catch ClosedResourceError. Fixes #134 #140

Closed nmichaud closed 3 years ago

coveralls commented 3 years ago

Pull Request Test Coverage Report for Build 106


Totals Coverage Status
Change from base Build 97: 0.2%
Covered Lines: 467
Relevant Lines: 488

💛 - Coveralls
nmichaud commented 3 years ago

This test is not quite deterministic - it seems to fail every 10 invocations. I'm going to see if i can narrow down the exact sequence of steps.

nmichaud commented 3 years ago

@belm0 I don't know if you can help me fix the test, the sequencing is a bit tricky - the issue seems to occur because _send_channel is closed while the reader task is still processing an event, so this line https://github.com/HyperionGray/trio-websocket/blob/master/trio_websocket/_impl.py#L1071 throws a trio.ClosedResourceError (trio.BrokenResourceError is only thrown when the _recv_channel is closed).

nmichaud commented 3 years ago

@belm0 OK this test consistently fails before the fix.

belm0 commented 3 years ago

thank you for spending time on a test ❤️