You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This bug report was migrated from our old Bugzilla tracker.
Reported in version: unspecified Reported for operating system, platform: Linux, All
Comments on the original bug report:
On 2006-01-31 09:25:25 +0000, Sam Lantinga wrote:
Date: Thu, 26 May 2005 15:48:34 +0300
From: Petri Latvala adrinael@nuclearzone.org
Subject: Re: [SDL] SDLNet_TCP_Send and SIGPIPE (Linux)
On Wed, Jan 19, 2005 at 05:16:04PM +0200, Antti Mannisto wrote:
My network game has worked for ages in Windows, but now that
I made a Linux version of it, there seem to be random crashes
every now and then. Everything has been made on top of SDL so the
code is identical. It is very hard to debug the problem since
a server may crash once in a month or so, but debug information
suggests that crashes might be related to SDLNet_TCP_Send.
With Valgrind, I am able to make send/SLNet_TCP_Send signal
SIGPIPE (and thus crash) when I disconnect from a server at a
certain time. It also seems that players with worse connections
are getting this problem more often.
The normal behaviour for send() is to SIGPIPE when the other end has
reset the connection, unless you pass MSG_NOSIGNAL as flags. Does
SDL_Net not do this?
Could this be a bug in SDL_net/SDL? I am using the latest library
versions (1.2.8 for SDL) and I can read in the change log that SDL
1.2.7 should have made SIGPIPE non-fatal, but what could then
explain this? Is it just Valgrind that is not working? And what
should I do to get rid of the problem? Define my own signal handler?
If SDL_Net uses send() without MSG_NOSIGNAL, it's a bug. In SDL_Net.
Would something get broken or could the problem be fixed
if I add "signal(SIGPIPE, SIG_IGN)" to somewhere in my code?
Where should it be put? After SDL and SDL_net have been initialized?
That will make you not crash, but will instead make you unable to
detect broken connections. And will make you try to send() repeatedly
to a bad fd. Don't do this.
... or you could, if you try to receive data quite directly after
trying to send, which will detect the broken connection in a nicer
way.
Disclaimer: I know nothing about the implementation of SDL_Net, I'm
just a POSIX hacker.
--
Petri Latvala
On 2006-05-01 03:37:34 +0000, Sam Lantinga wrote:
SDL_net now sets a SIGPIPE handler, for maximum portability. The semantic has always been that if SDLNet_TCP_Send() returns less data then you requested sending, then the socket has been closed, or another error has occurred.
for portable code, some of the BSD-derivatives have a socket option SO_NOSIGPIPE which lets you disable this on a per-socket basis, which is often nicer. Linux has an option to send(2) MSG_NOSIGNAL which disables SIGPIPE on a per-send() basis (not as nice as the socket option, IMO). but the only thing to work portably is to SIG_IGN it.
The text was updated successfully, but these errors were encountered:
This bug report was migrated from our old Bugzilla tracker.
Reported in version: unspecified
Reported for operating system, platform: Linux, All
Comments on the original bug report:
On 2006-01-31 09:25:25 +0000, Sam Lantinga wrote:
On 2006-05-01 03:37:34 +0000, Sam Lantinga wrote:
The text was updated successfully, but these errors were encountered: