Repository navigation
Raise exceptions in Server.handle_stream instead of swallowing/logging. - #7162
Conversation
Unit Test ResultsSee test report for an extended history of previous test failures. This is useful for diagnosing flaky tests. 15 files ±0 15 suites ±0 6h 26m 36s ⏱️ - 19m 14s For more details on these failures, see this check. Results for commit 5871722. ± Comparison against base commit a573da0. ♻️ This comment has been updated with latest results. |
| logger.info( | ||
| "Received 'close-stream' from %s; closing.", | ||
| comm.peer_address, | ||
| ) |
There was a problem hiding this comment.
This is a bit verbose, isn't it?
There was a problem hiding this comment.
close-stream should only occur in a few instances, I would like to be able to see when those happen.
|
After an offline discussion with @fjetter, we decided that |
OSError in Server.handle_stream.Server.handle_stream instead of swallowing/logging.
| try: | ||
| msgs = await comm.read() | ||
| # If another coroutine has closed the comm, stop handling the stream. | ||
| except CommClosedError: |
There was a problem hiding this comment.
As discussed offline with @fjetter, we should use the CommClosedError as a stopping and synchronization mechanism between coroutines that are dealing with the comm. If one of them decides to close the comm, the CommClosedError allows us to propagate that without race conditions.
There was a problem hiding this comment.
FWIW It's not ideal but I believe this is how it was intended at some point. We may need to revise this but that would be a bigger change that is feasible right now.
When closing the stream handler, it would be helpful to understand the reason instead of stopping silently.
In particular, we should not swallow an
OSErrorsilently when it may lead to the comm being closed.pre-commit run --all-files