This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Shells hang during script execution


On Thu, Feb 23, 2006 at 04:40:33PM -0500, Christopher Faylor wrote:
>On Thu, Feb 23, 2006 at 04:33:45PM -0500, Ernie Coskrey wrote:
>>There are two hang conditions that we've identified and have developed fixes for.  This is a description of the first of the two along with a patch; I'll follow up with a description and patch for the second.
>>
>>
>>If a signal can't be handled because it is blocked, it gets queued (on 
>>the process's "sigq") to be handled later. Now, whenever the process's 
>>signal mask changes (e.g., the signal in question gets unblocked), an 
>>attempt is made to handle all the queued signals (i.e., a signal flush 
>>occurs). However, if the queueing of the blocked signal happens right 
>>after the signal mask change, then we miss the signal. This causes the 
>>process to hang. The signal is on the queue, but the process doesn't 
>>know to check for it. The process just hangs until another signal gets 
>>sent to it.
>>
>>The workaround is basically to force the signal queue to be rescanned 
>>(flushed) whenever we add something to it, so a queued signal is never 
>>missed.
>
>Thanks for the analysis and the patch.
>
>But, a backwards goto into a case?  Yuck.  I'll see if I can come up
>with something better.

Actually, I spoke too soon.  I don't understand your analysis.

You make this statement:

>>However, if the queueing of the blocked signal happens right after the
>>signal mask change, then we miss the signal.

but I don't understand how you came to this conclusion.  If the signal mask
changes, then the queue should be flushed -- that's what the __SIGFLUSH is
for.  So, even if something is added to the queue while the mask is changing,
the function which changes the mask should eventually call send_sig to cause
the wait_sig thread to run the queue.

So, this patch would seem to be a band-aid over some other problem.

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]