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

Treat ECONNRESET like EPIPE (i.e. ignore), not as a fatal error. #114

Merged
merged 1 commit into from
Jun 3, 2015

Conversation

timbunce
Copy link
Contributor

@timbunce timbunce commented May 5, 2015

If the client closed the connection before reading all the data,
or there's a network failure that results in the connection being reset,
we shouldn't treat that as a fatal error. It's much more like EPIPE
so now we treat it that way.

If the client closed the connection before reading all the data,
or there's a network failure that results in the connection being reset,
we shouldn't treat that as a fatal error. It's much more like EPIPE
so now we treat it that way.
@timbunce
Copy link
Contributor Author

timbunce commented May 5, 2015

We encountered this issue due to a health-check that only read the headers of the response (sent by the first _syswrite() call) and then closed the connection without reading the body (sent by a second _syswrite() call).

So there was a race-hazard: From time-to-time the OS would notice the socket closing before the second syswrite and then we'd get a "write error: Connection reset by peer" error.

@ap
Copy link
Contributor

ap commented May 5, 2015

Nice – this has bugged me before, but never enough yet to get me to investigate.

Is there a reason you didn’t put it in the same statement
as in return if $! == EPIPE or $! == ECONNRESET?

@miyagawa
Copy link
Owner

miyagawa commented May 5, 2015

Looks good. Is there a way to locally test this behavior to get it verified?

@timbunce
Copy link
Contributor Author

timbunce commented May 6, 2015

@ap: no reason not to use return if $! == EPIPE or $! == ECONNRESET; - I was just keeping the diff as trivial as possible.
@miyagawa: not easy to test locally, but tested in staging and will be deployed to production today :)

@miyagawa
Copy link
Owner

miyagawa commented May 6, 2015

Well if it's not as easy as a unit test, a contrived example to reproduce the issue would be more than appreciated.

miyagawa added a commit that referenced this pull request Jun 3, 2015
Treat ECONNRESET like EPIPE (i.e. ignore), not as a fatal error.
@miyagawa miyagawa merged commit 9bcb99c into miyagawa:master Jun 3, 2015
@timbunce
Copy link
Contributor Author

timbunce commented Jun 4, 2015

Thanks. Sorry for not getting around to making a test for it. We've had it in production for weeks though.

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

Successfully merging this pull request may close these issues.

None yet

3 participants