-
Notifications
You must be signed in to change notification settings - Fork 7.3k
net.Socket.on('close', function(had_err) {}) doesn't set error in the case of TCP RST's #1776
Comments
Turns out I filed a duplicate here: Closed out now. Pasting in the helpful bits from the other issue:
Repro code can be found in this gist (thanks to issacs): Node should either emit an 'error', or set net.Socket.errorEmitted to true. And/or do what Mark suggests above. |
Yeah, this sucks. Of course, a reset is not properly an "error" that should throw, but just something that your app should handle, but it's impossible to handle it if you don't know that it was even reset. |
FWIW, I think a TCP reset actually does warrant an |
Let ECONNRESET network errors bubble up so clients can detect them. Commit c4454d2 suppressed and turned them into regular end-of-stream events to fix the then-failing simple/test-regress-GH-1531 test. See also issue #1571 for (scant) details. It turns out that special handling is no longer necessary. Remove the special casing and let the error bubble up naturally. pummel/test-https-ci-reneg-attack and pummel/test-tls-ci-reneg-attack are updated because they expected an EPIPE error code that is now an ECONNRESET. Suppression of the ECONNRESET prevented the test from detecting that the connection has been severed whereupon the next write would fail with an EPIPE. Fixes #1776.
Let ECONNRESET network errors bubble up so clients can detect them. Commit c4454d2 suppressed and turned them into regular end-of-stream events to fix the then-failing simple/test-regress-GH-1531 test. See also issue nodejs#1571 for (scant) details. It turns out that special handling is no longer necessary. Remove the special casing and let the error bubble up naturally. pummel/test-https-ci-reneg-attack and pummel/test-tls-ci-reneg-attack are updated because they expected an EPIPE error code that is now an ECONNRESET. Suppression of the ECONNRESET prevented the test from detecting that the connection has been severed whereupon the next write would fail with an EPIPE. Fixes nodejs#1776.
@bnoordhuis this change seems OK, but it breaks a few tests. Updated on https://github.com/isaacs/node/compare/econnreset, if you'd be so kind as to review. I do wonder if it's appropriate to emit('error') on this case, since it was never a throwable offense in the past. I suspect we might have some grumpy users. It's not too uncommon to just destroy connections in HTTP. It might be worth suppressing this error in |
Which is fairly unexpected. Code that explicitly disables this is here:
https://github.com/joyent/node/blob/f9fec3a2d65580b7e39edc9afd5904cd4775c87c/lib/net.js#L634-638
The text was updated successfully, but these errors were encountered: