[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Deadlock on performSelectorOnMainThread:

From: Richard Frith-Macdonald
Subject: Re: Deadlock on performSelectorOnMainThread:
Date: Mon, 30 Aug 2010 20:18:19 +0100

On 26 Aug 2010, at 07:43, Jonathan Gillaspie wrote:

> We are running into an occasional problem with our application on GNUstep 
> (Ubuntu 9.04) where we deadlock when attempting to call 
> performSelectorOnMainThread:  The back trace with the locked threads is 
> included below.  The only condition that I can see for this situation is that 
> somehow the outputFD of the pipe that is used to "trigger" the main run loop  
>  to pick-up is blocked and can't be written to (GSRunLoopThreadInfo of 
> NSThread.m).  I do notice that although NBLK_OPT is set for the inputFD, it 
> isn't set for outputFD which seems to be where the deadlock is occurring.
> First, does anyone have an alternate (or clearer vision) of why this deadlock 
> condition is occuring?
> Second, does anyone have a preferred solution other than to allow the 
> outputFD to not-block?
> Thanks for any help with this issue,

Clearly this shouldn't happen, and I've tried changing the code to avoid this 
by (as you suggest) making the write non-blocking.

But ...
The write sends a single byte to the pipe ... and the pipe buffer is typically 
8 or 16 KB in size ... so for the buffer to be full, the threads calling the 
method are presumably doing so faster than the main thread can handle them.
That might mean there is a bug in the application too.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]