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
os.write on a closed socket triggers SIGPIPE #5614
Comments
Would the right thing to do be to set MSG_NOSIGNAL by default on network sockets? I just ran into this, seems like a horrible default behavior to have a network program exit without any message when the remote end closes |
Correct, the best thing to do by default on network sockets is MSG_NOSIGNAL |
I was asking if the stdlib should set it automatically, but I just realized it seems to be Linux-specific... there seems to be no equivalent to the MSG constants on windows for example. |
Windows doesn't have SIGPIPE. It does the equivalent of MSG_NOSIGNAL and returns the windows version of EPIPE (BROKEN_PIPE). This doesn't break on windows because it doesn't need to do this. |
Calling os.write() on a peer-closed socket without the
MSG_NOSIGNAL
flag triggers a SIGPIPE, rather than return an EPIPE errno.The text was updated successfully, but these errors were encountered: