Detecting source of SIG-PIPE

Hello,

I have an app with several 3rd party components. One of the issues I noticed is, crashes due to SIG-PIPE signals. Since then, we added a SIG-PIPE handler, we seems to have some other issues every since we added SIG-PIPE handler. While we are investigating that, we also wanted to make sure all sockets are operating with an option to ignore sig-pipe. Most said they said their sockets are ignoring sig-pipe, we still see SIG-PIPE signals being generated. Is there a way to identify which socket is creating SIG-PIPE signal? so that it is easy to fix them.

Thanks,

Replies

1) It is common to use signal(SIGPIPE, SIG_IGN) to just ignore all SIGPIPE signals.


2) If you remove the SIGPIPE handler you added (and don't do the above), then the crashes will identify which code is writing to a broken connection. If it's not immediately obvious which code is responsible for the file descriptor, I think you can use the File Activity instrument in Instruments to track where any given file descriptor was opened.


3) If you continue to use a SIGPIPE handler, you can try to make it collect a stack trace internally, although that's not easy. You can see if you can leverage a third-party framework for this, such as PLCrashReporter.