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

read from FIFOBuffer blocks forever on server disconnect #87

Closed
samoconnor opened this issue Aug 30, 2017 · 1 comment
Closed

read from FIFOBuffer blocks forever on server disconnect #87

samoconnor opened this issue Aug 30, 2017 · 1 comment

Comments

@samoconnor
Copy link
Contributor

I have a simple Node.js server that streams data forever:

var http = require('http');

http.createServer(function(req, res) {

  setInterval(function() {
    res.write('Hello\n');
  }, 1000);

}).listen(8000);

I can read from this server in a while !eof() loop as shown below.
However, if I kill the node server, the Julia read loop just hangs forever.

julia> r = HTTP.get("http://127.0.0.1:8000"; stream = true)
julia> io = HTTP.body(r)
julia> while !eof(io)
           println(String(readavailable(io)))
       end
Hello
Hello
Hello
Hello
Hello
Hello

Hello

Hello

Hello

With curl, the server close is noticed immediately.

$ curl 127.0.0.1:8000
Hello
Hello
Hello
curl: (18) transfer closed with outstanding read data remaining
$ git log -1
commit 9200ae3de838b78753e13488918ab583172c3ddf (HEAD, refs/remotes/origin/master, refs/heads/master)
Author: quinnj <[email protected]>
Date:   Tue Aug 29 21:24:39 2017 -0600

    Cleanup recent parser changes a bit
@quinnj quinnj closed this as completed in 18c5052 Aug 30, 2017
@quinnj
Copy link
Member

quinnj commented Aug 30, 2017

Thanks for the report, just pushed a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants