[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #30477] "help" command hangs because SIGCHLD h
From: |
Matt McCutchen |
Subject: |
[Octave-bug-tracker] [bug #30477] "help" command hangs because SIGCHLD handler is not async-signal-safe |
Date: |
Sun, 19 Sep 2010 20:35:55 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.7) Gecko/20100827 Fedora/3.6.7-1.fc13 Namoroka/3.6.7 |
Follow-up Comment #8, bug #30477 (project octave):
I tried to repeat the test with the current development Octave, but I got a
build failure; I submitted bug #31074.
> OR, it would help if someone could explain how Octave's sigchld_handler
function in src/sighandlers.cc should be changed so that it will work properly
on your system.
Suppose the main program is in the middle of a call to __libc_malloc (the
common backend to malloc, operator new, etc.). If a SIGCHLD arrives,
sigchld_handler is invoked, and it may invoke __libc_malloc again via
octave_child_list::instance_ok. __libc_malloc takes a lock, so the reentrant
call causes a hang. If it weren't for that lock, attempting to allocate on a
heap already in an intermediate state from the outer __libc_malloc would cause
corruption.
See the discussion of async-signal-safe functions in the POSIX standard:
http://www.opengroup.org/onlinepubs/9699919799/xrat/V4_xsh_chap02.html#tag_22_02_04_04
The typical solution would be to redesign the sigchld_handler so that it
never calls __libc_malloc. It would also work to block SIGCHLD in any part of
the main program where a SIGCHLD could arrive during a call to __libc_malloc,
or switch to handling SIGCHLD via signalfd (but signalfd is only available on
Linux, and this problem probably affects other unices too).
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?30477>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/