Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readavailable returns 0 bytes #795

Closed
tbenst opened this issue Dec 19, 2021 · 1 comment
Closed

readavailable returns 0 bytes #795

tbenst opened this issue Dec 19, 2021 · 1 comment
Labels
bug client About our HTTP client websockets

Comments

@tbenst
Copy link

tbenst commented Dec 19, 2021

I'm subscribing to topics on a webserver, and when I subscribe to 15 topics everything is fine, but when I subscribe to more, say 20 or 50, I start reading IO with 0 bytes. My code looks something like,

HTTP.WebSockets.open(ws_endpoint) do ws
  # [subscribe to topics by writing to ws]
  while true
    if !eof(ws)
      @info length(readavailable(ws))
    end
  end
end

And the output is something like,

[ Info: 88
[ Info: 88
[ Info: 88
[...]
[ Info: 88
[ Info: 88
[ Info: 0
[hangs]

I thought !eof should guarantee that at least 1 byte is read? I think what's happening is HTTP.WebSockets.open can't keep up with the message rate, as it's failing in 10-100K / s range, but succeeding around 1K / s (order of magnitude). However I'm not sure if this diagnosis is correct--I'm a bit at a loss for what could be going wrong.

I tried to create a MWE using a fast websocket server that ought to be able to create >10K messages / sec but got stuck on #794

versions

  • Julia 1.6.1
  • HTTP v0.9.17
@fonsp fonsp added bug websockets client About our HTTP client labels Mar 16, 2022
@quinnj
Copy link
Member

quinnj commented Jun 11, 2022

The problem in the old websockets code is that if an empty CLOSE message was received from the remote connection, this "empty message" was returned to the user instead of being thrown as an error which non-empty CLOSE messages would do.

I just merged an overhaul of the websockets code that fixes this, so HTTP#master should be correct now.

@quinnj quinnj closed this as completed Jun 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug client About our HTTP client websockets
Projects
None yet
Development

No branches or pull requests

3 participants