Skip to content

read from FIFOBuffer blocks forever on server disconnect #87

Closed
@samoconnor

Description

@samoconnor

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 <quinn.jacobd@gmail.com>
Date:   Tue Aug 29 21:24:39 2017 -0600

    Cleanup recent parser changes a bit

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions