-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Error: stream.push() after EOF #5439
Comments
That's super weird. Can you share the code? It looks like we're getting the EOF, and then getting some more data. |
I believe that happens for some URLs. Currently sending requests to lots of URLs, I'll be locating the problematic one and updating back. |
Managed to catch it. Writing quickly as it can disappear. That happens when sending a request (I'm sending HEAD) to: http://www.pourton.info/ The site is having some problems as far as I can see that generates lots of errors and that is somehow causing that error to appear. On the other hand, the issue doesn't appear always but once in 15-20 requests. Will be adding a test code soon. |
Until I prepare the test environment, the error no longer exists on the site. However, I was able to take a snapshot (headers - response) of the request using web-sniffer: http://www.fileswap.com/dl/TIoYb6MQQX/ to give an idea. Btw, is there a way to detect that error, isolate it and prevent the process from failing? |
I'm having this bug as well, on v0.10.9 as well as on latest git master branch. |
Btw, I couldn't found a fix and downgraded to an older version. |
Having it on 0.10.10 too i am grabbing a lot of urls (no HEAD request, only GET), any idea how i can catch it? |
Hm. Every attempt I make to reproduce this only results in a parse error. Can you try applying isaacs/node@547c336 and see if that fixes the problem you're having? If so, it's potentially a duplicate of #5695, but no one has mentioned calling abort(), so I somewhat doubt that. |
I am calling abort(). Reverting to 0.10.4 as #5695 fixed the issue, so I think it's probably that. |
@kpwn Great news, thanks! @umutm Does the fix in isaacs/node-v0.x-archive@547c336 address your problem as well? If so, I suggest closing this as a dupe of #5695. |
This still happens with the latest v0.10, haven't tried v0.11. I don't have a test case that finishes within a reasonable amount of time - it seems to be rather timing sensitive, it happens only once every few hundred or thousand requests - but I have been able to establish that:
The stack trace looks different now than it does in the original bug report:
My current working hypothesis is that two TCP packets come in on the same tick and that response.end() is called after processing the first one but before the second one. I've been trying to follow the logic in |
I think my working hypothesis is right. Here is a test case: var http = require('http');
var net = require('net');
http.createServer(function(req, res) {
req.once('data', function() { res.end() });
res.write('.');
this.close();
}).listen(function() {
var conn = net.connect({
host: this.address().address,
port: this.address().port,
});
conn.write('POST / HTTP/1.1\r\n' +
'Transfer-Encoding: chunked\r\n' +
'Connection: close\r\n' +
'\r\n');
conn.once('data', function() {
var chunk = Array(1 << 6).join('.');
chunk = chunk.length.toString(16) + '\r\n' + chunk + '\r\n';
while (conn.write(chunk) !== false) delay(1);
});
conn.once('error', console.error.bind(null, 'conn error'));
});
function delay(ms) {
var t = Date.now();
while (ms > Date.now() - t);
} It looks like it's fixed in master but caveat emptor, I didn't try too hard. I don't believe @isaacs is still around so I'm channeling, oh I don't know, @indutny? |
So https://github.com/joyent/node/blame/v0.10/lib/http.js#L347 Is the offending code, in master that code path changed with a454063 Speculatively I made that change locally before finding that commit and your test case works fine. I'm not sure why It seems like we can reasonably backport this |
Both |
bumping myself @indutny |
Should be fixed by f2b297c |
Hi,
I'm sending a large number of HTTP requests to multiple hosts.
Using nodejs v0.10.5 and sometimes getting the error below:
Couldn't isolate it yet as I couldn't find a clue about it with Googling.
Any help is so appreciated.
The text was updated successfully, but these errors were encountered: