site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On 23 Jan 2008, at 20:48, Jonathan del Strother wrote: I keep running into an apparent deadlock within fprintf. I can semi-reliably reproduce it within my application, but have been totally unable to reduce the problem to a smaller test case. In a nutshell, I have two threads calling this - fprintf(stderr, "%s:%d - %s\n", [fileBaseName cStringUsingEncoding:NSASCIIStringEncoding], lineNumber, [formattedMessage cStringUsingEncoding:NSASCIIStringEncoding]); resulting in the following stack trace. The first thread just sits in write$NOCANCEL$UNIX2003() for ever. Jonas _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... Do you change stderr to point somewhere specific, and if not, do you pipe the output of your program to some other program? (e.g. a pipe has a buffer of 4KB and once it is full, your program will block writing until the other side empties the pipe). Also, if this is a GUI app (or a daemon?), the stderr stuff may go by default to the console or system log, filling up some disk (although I assume that's unlikely in this case). Anyway, the problem you have is most likely not caused by fprintf not being thread safe, but by the write operation blocking for some reason. This email sent to site_archiver@lists.apple.com