Cancel request and depended spawned tasks for streamed data #85
-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
My reproduction of this using your code always results in the stream exiting after a few seconds. I suspect it has something to do with leftover TCP connections at the OS level keeping the HTTP server alive for a while. For me, at least, on macOS, this seems to resolve itself. Maybe you're seeing infinite looping on Linux? A somewhat more reliable test I've found is to use cURL's See that it prints "closing connection" whereas just ctrl-c is a more forceful shutdown that is likely to leave OS resources hanging. |
Beta Was this translation helpful? Give feedback.
My reproduction of this using your code always results in the stream exiting after a few seconds. I suspect it has something to do with leftover TCP connections at the OS level keeping the HTTP server alive for a while. For me, at least, on macOS, this seems to resolve itself. Maybe you're seeing infinite looping on Linux?
A somewhat more reliable test I've found is to use cURL's
--max-time
flag, which seems to shut down the TCP connection in a cleaner way, such that the next loop iteration more often exits out.See that it prints "closing connection" whereas just ctrl-c is a more forceful shutdown that is likely to leave OS resources hanging.