[Gc] Allowing SIGINT during garbage collection may result in deadlock

Juan Jose Garcia-Ripoll juanjose.garciaripoll at googlemail.com
Tue Apr 20 01:47:31 PDT 2010


2010/4/20 Ivan Maidanski <ivmai at mail.ru>

>
> Tue, 20 Apr 2010 09:57:04 +0200 Juan Jose Garcia-Ripoll <
> juanjose.garciaripoll at googlemail.com>:
> > It is not safe to call _almost_ _any_ function from a signal handler, not
> > even malloc()
> >
> >
> http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html#tag_02_04
> > Signal handlers are useless in that respect, except for sending messages
> to
> > threads that actually do the job.
>
> So, mono is broken in this respect.
>

Quite probably so. I maintain a Common Lisp implementation (ECL) and it got
us five years to realize this.

Our current design uses a background thread that intercepts all signals. It
then stores messages in queues of the appropriate Lisp threads and these
queues are interrogated once we leave the signal unsafe regions.

I agree this sucks, but it is all POSIX allows us. And we were bitten not
too long ago because of the reentrancy problem, not only in GC, but also in
file operations, etc, etc.

Juanjo

-- 
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://tream.dreamhosters.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://napali.hpl.hp.com/pipermail/gc/attachments/20100420/6f1fd42f/attachment.htm


More information about the Gc mailing list