Re: SIGTRAP after writing to socket
Re: SIGTRAP after writing to socket
- Subject: Re: SIGTRAP after writing to socket
- From: Stefan Werner <email@hidden>
- Date: Fri, 1 Dec 2006 20:53:36 +0100
On Dec 1, 2006, at 11:37 AM, Quinn wrote:
I can try and get one, even though it's not going to be very
useful. At the time SIGTRAP reaches the application, the thread
that has done the network operations has finished executed
already, so the crash log shows call stacks from a pretty random
point in time, up to a few seconds after the last call to socked
APIs.
I'd still like to take a look. It's /so/ improbable for sockets
code to generating SIGTRAP...
Giving it another close look, it could quite well be that the SIGTRAP
does not come from the networking directly but rather from the
runtime library: One constant I found in the crash logs is that one
of my threads always shows this call stack:
0 com.apple.CoreFoundation 0x901d1b48 CFRunLoopWakeUp + 0x38
1 com.apple.Foundation 0x90a8f374 _waitForTermination +
0x9c
2 libSystem.B.dylib 0x90024990 _pthread_body + 0x28
To give more background information about this thread:
It is a POSIX thread. The networking code in question is running in
this thread. I do not explicitly create a CFRunLoop in this thread. I
do, however, explicitly create a NSAutoreleasePool in this thread
that gets released before the thread finishes. Cocoa is in
multithreaded mode before this happens. The networking code in this
thread will cause a SIGPIPE to occur, I do tell the system to ignore it:
struct sigaction act;
act.sa_handler = SIG_IGN;
sigemptyset (&act.sa_mask);
act.sa_flags = 0;
sigaction (SIGPIPE, &act, NULL);
This is being done in that very thread and not the application's main
thread.
Again, the whole thing does not happen when the thread only opens and
closes the socket but does not write to it. As soon as it writes to
it, the program may receive receive a SIGPIPE, which is ignored
correctly, then the program receives a SIGTRAP when the thread
terminates. All the socket operations are asynchronous. The SIGTRAP
occurs only on 10.3.9, not on 10.4.
Do I maybe need to take special precautions for catching signals that
come from a subthread of my app?
Thanks,
Stefan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden