develooper Front page | perl.perl5.porters | Postings from June 2010

Re: [perl #74868] Safe signals changes causing hangs with threads

Thread Previous
Dave Mitchell
June 4, 2010 09:15
Re: [perl #74868] Safe signals changes causing hangs with threads
Message ID:
On Mon, May 03, 2010 at 06:48:03AM -0700, Jerry D. Hedden wrote:
> Commit f410a2119920dd04690025a349e79575cfb9c972 to blead
> changed where PERL_ASYNC_CHECK() is called for safe signals.
> One of the changes added PERL_ASYNC_CHECK() to the end of
> Perl_leave_scope().  However, this causes deadlocks to occur
> if a signal handler in a threaded application tries to
> lock() a shared variable "at the same time" that another
> thread tries to manipulate another shared variable.
> This was noticed because the Thread::Suspend module's test
> suite was frequently hanging.  My original posting and Dave
> Mitchell's reply can be found here:
> Attached is a patch to fix this problem by removing the
> PERL_ASYNC_CHECK() call from Perl_leave_scope().  I have
> tested this patch and have been using it for several days
> and have not found any problems with it.

I've gone with Nicholas's suggestion and added a veto on signal handler
calling while we hold the global lock.

This is done with commits

    adds PL_signalhook to core

    makes threads::shared use PL_signalhook

Spock (or Data) is fired from his high-ranking position for not being able
to understand the most basic nuances of about one in three sentences that
anyone says to him.
    -- Things That Never Happen in "Star Trek" #19

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About