简体   繁体   中英

Debugging a SIGPIPE signal from third party library

I am debugging a significantly large Qt-3 application. The application does a lot of pre-processing and then receives a SIGPIPE signal. I'm writing down few entries of the backtrace as soon as I get SIGPIPE.

#0 .. __write_nocancel () from libpthread.so
#1 .. _IceTransFreeConnInfo () from libICE.so.6
#2 .. _IceWrite () from libICE.so.6
#3 .. _IceFlush () from libICE.so.6

Our application has a signal handler. What I did was to ignore SIGPIPE using signal(SIGPIPE, SIG_IGN) , thinking that my app will continue even if I get this signal. But now I realize that it will not work that way, it just exists if I continue after receiving SIGPIPE.

I am clueless as how to debug this issue. This signal is not originating from a socket call directly by our app. It is coming from libICE. Am I correct? Please give some hints on how to debug this.

thanks in advance.

The signal is coming from the kernel, and is the result of write(2) ing to a file descriptor, for which the receiver has either died, or executed a shutdown(2) .

It sounds as if something in your code screwed up a file descriptor that belongs to libICE.so , and not to you.

Your first step should probably be to run the application under strace , and then analyze the log to see exactly how the FD on which libICE is writing has been screwed up.

Once you know what is happening, use GDB catch syscall command to find out where it is happening.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM