-
Notifications
You must be signed in to change notification settings - Fork 182
Description
Hi, I've used this construction [1] for what feels like years now and it works great.
But now I'm trying to handle scenarios where url isn't immediately available.
Here's what I actually see: I'm subscribing to some websocket data for hours, at some point I get EOFError on this line [2]. My code catches it, it starts to try re-connecting, but it's never successful in re-connecting and I lose the data that comes after.
Here's what I suspect is happening: I'm subscribing to some websocket data, the server reboots, connection closes, I retry immediately, but the server is no longer available while it's rebooting. The connection waits forever and isn't successful even after the server is back. This just waits forever and I lose the data that comes after.
So, why is it that timeout doesn't work in the second case? For example, timeout works:
HTTP.get(
"http://httpbin.org/delay/2";
readtimeout=1,
retry=false,
)
# ERROR: TimeoutError: Connection closed after 1 seconds
Great. However:
headers = Dict(
"Upgrade" => "websocket",
"Connection" => "Upgrade",
"Sec-WebSocket-Key" => "dGhlIHNhbXBsZSBub25jZQ==",
"Sec-WebSocket-Version" => "13")
socket, response = HTTP.openraw(
"GET",
"http://httpbin.org/delay/2",
headers;
readtimeout=1,
retry=false,
)
# hangs forever
I would like to understand what's happening here and how to avoid it, because I think this is happening in my code.
I'm willing to go investigate and fix this, if the author could first confirm that this is an actual bug and not some misunderstanding on my part.
[1] https://discourse.julialang.org/t/http-jl-websockets-help-getting-started/102867/4
[2]
Line 203 in 0abbfb1
| unsafe_read(c.io, p, n) |