-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Large file downloads failing in 0.6.9 #2678
Comments
Can you post a test case? I don't seem to be able to reproduce it. |
Found the culprit, added to the gist. I guess you may not consider it a bug given what has been done, but I would not have expected the observed results. |
@OrangeDog - Because your So, can you try like this? response.write = function(data, /*optional*/ encoding) {
var result = originalWrite(data, encoding);
request.totalLength += typeof data === 'string' ? Buffer.byteLength(data) : data.length;
return result;
}; |
@koichik Only exact boolean I think the issue is that you can have a condition where the file read stream emits "close", and this triggers It's very tricky to trigger in a test, because you need to have a file read stream that's faster than the HTTP response, which requires a very slow client connection. @OrangeDog Can you add this line and see if it prevents the error? response.destroy = function () {} It's not a good long-term fix, of course, but if it keeps the Bad Thing from happening, it'll be good information. The long-term fix is to comb through all the edge cases in our Stream api. This is a big todo item, definitely a 1.0 must-have, but not going to happen in 0.8 for sure. Thanks. |
You are right, I should have gone to the bed before writing the comment (it was 4:00 a.m. in JST).
|
@OrangeDog - Thanks, I have just found the bug that is related to #2002. Reopening. |
@isaacs - Can you review koichik/node@c4ebe64? |
@koichik LGTM. Good find. |
@isaacs - Thanks, merging. |
@OrangeDog - Thanks for the report, fixed in 0f0af55. |
A rather complex server has a request handler that, after various async i/o, offers a large file for download.
except with error handling etc.
However, on upgrading to Node 0.6.9 from 0.4.11, we noticed that the download is often mysteriously truncated with no errors logged except a Broken Pipe error in an stunnel instance. Investigation reveals that this occurs every time after two minutes when using curl (to Node directly, bypassing stunnel) if the option
--limit-rate 50k
is used. Successful download using Node 0.4.11 takes ~3:30 with the same curl command.Some details in this gist. Note that in the failing case it is Node that sends the first FIN.
Can provide more (e.g. full pcap traces) if required.
The text was updated successfully, but these errors were encountered: