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

Socket server crashes if the socket is closed by the remote host before stream_socket_accept is called #22

Closed
krageon opened this issue Sep 16, 2015 · 6 comments
Milestone

Comments

@krageon
Copy link

krageon commented Sep 16, 2015

If the remote host closes the socket early, this raises an E_WARNING when calling stream_socket_accept. This turns into an exception (depending on your configuration).

Seeing as the output of this function is checked (false or something else) exactly one line after it is called, it makes sense to suppress the warnings and use the existing handling for this case.

@clue
Copy link
Member

clue commented Oct 8, 2015

If the remote host closes the socket early, this raises an E_WARNING when calling stream_socket_accept.

We have yet to find a way to reproduce the issue you're seeing. I've given this several attempts, but failed to raise an error here so far.

Perhaps https://3v4l.org/LlXo1 could be a good starting point.

This turns into an exception (depending on your configuration).

I'm not sure I follow? If we manage to reproduce this, then this will raise an (uncaught) E_WARNING only and will then raise an error event as documented.

Seeing as the output of this function is checked (false or something else) exactly one line after it is called, it makes sense to suppress the warnings and use the existing handling for this case.

Agreed, we should not raise any warnings whatsoever.

@krageon
Copy link
Author

krageon commented Oct 8, 2015

It raises the E_WARNING immediately, the error event handler will not happen (this is because that event gets raised because of some function output, but the warning pops up as soon as the function executes).

I'll try and see if I can get a good simple case going tomorrow. As I said on the pull request, I've only managed to reproduce the issue using HAProxy's tcp-check so far.

@clue
Copy link
Member

clue commented Oct 12, 2015

It raises the E_WARNING immediately, the error event handler will not happen (this is because that event gets raised because of some function output, but the warning pops up as soon as the function executes).

I agree that this warning shouldn't be raised to begin with and we should address this. However, this warning alone should not interfere with the error event handler and should not stop script execution. In other words, we have yet to reproduce how this "crashes".

For the reference, the accept(2) man pages list some error conditions which should help in providing a test script.

@WyriHaximus
Copy link
Member

@krageon can you share how you can reproduce it? I'de like to get this thing resolved so I'm looking into making a test for it

@krageon
Copy link
Author

krageon commented Nov 19, 2015

A little while ago I sat down with a colleague of mine in an attempt to replicate a simpler version of the environment that produces this, but we can't seem to do it outside of where it actually occurs. At this point I'm more inclined to say it's not necessarily a problem with the library, but with where I'm using it.

@cboden cboden added this to the v0.4.3 milestone Jan 19, 2016
@cboden
Copy link
Member

cboden commented Jan 19, 2016

fixed in #23

@cboden cboden closed this as completed Jan 19, 2016
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

No branches or pull requests

4 participants