winddriver / Delphi-Cross-Socket

Delphi cross platform socket library
GNU Lesser General Public License v3.0
407 stars 154 forks source link

MSG_NOSIGNAL is not set on Linux, causing SIGPIPE exceptions to be raised #6

Closed allendrennan closed 6 years ago

allendrennan commented 7 years ago

I have been testing under Linux and encountering a few issues. This is the stress tool I use. One issue is Broken Pipe exceptions.

To reproduce use URLStress, https://blogs.msdn.microsoft.com/friis/2010/12/28/urlstress-a-simple-gui-tool-with-source-code-to-stress-your-favorite-web-server/ Direct download: https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/10/96/08/URLSTRESS.zip

allendrennan commented 6 years ago

One of the issues is that it attempts to write to the socket after the socket is closed by the peer. This raises a EPIPE/SIGPIPE exception (broken pipe) on the call to Send() on POSIX. This can be avoided by adding the flag MSG_NOSIGNAL to the Posix Send routine.

There are still other issues I am investing on Linux.