Skip to content
Discussion options

You must be logged in to vote

The cause is anyio #1391. Closing a memory stream now wakes a blocked receive() with ClosedResourceError, not EndOfStream. My tests:

  • Minimal anyio script, close the stream during receive() - 4.15.1 EndOfStream, 4.16.0 ClosedResourceError
  • Fix below in _transport.py aclose() - 190 websocket tests pass on 4.15.1 and 4.16.0
await self._receive_queue.aclose()
await self._send_queue.send_stream.aclose()
await anyio.lowlevel.checkpoint()
await self._send_queue.receive_stream.aclose()

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@g4lb
Comment options

@mweinelt
Comment options

@musicinmybrain
Comment options

@Kludex
Comment options

@musicinmybrain
Comment options

Answer selected by musicinmybrain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants