Re: Non-re-entrant code in signal handler

Bob Friesenhahn <[email protected]> Mon, 9 Dec 2013 19:43:00 -0600 (CST)
Newsgroups gmane.comp.video.graphicsmagick.bugs
Message-ID <[email protected]>
On Mon, 9 Dec 2013, Jason Abernathy wrote:

> I believe that non-re-entrant code is being executed within the MagickSignalHandler function.
> 
> In particular, DestroyMagickInfo eventually calls free(), which is not async-safe. This leads to a deadlock on my system
> (Ubuntu 12.04, GraphicsMagick 1.3.12).

After almost another three years, we are up to 1.3.18 already and 
1.3.19 should emerge within the next month or two.  1.3.12 is really 
old.  I am not sure why Debian/Ubtuntu sticks with it.  Sticking with 
it is almost criminal.

On 2011-02-20 I implemented a major change to how signals are handled 
to avoid a deadlock problem.  This change was first released in 
1.3.13.

The problem is not that free() is not async-safe (although that is 
indeed a problem).  The problem was that threads are still using the 
memory (which includes locks) when it was released.

Bob
-- 
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk