In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/4da80956418bbe1fdc23cad0b1cbb24cd7b87609?hp=5c14d9877d3a861124eab75846a98fe56e74f27d>
- Log ----------------------------------------------------------------- commit 4da80956418bbe1fdc23cad0b1cbb24cd7b87609 Author: Patrik Hägglund <[email protected]> Date: Sat Feb 2 20:21:05 2013 +0100 PATCH [perl #106212] Add PL_perlio_mutex to atfork_lock/unlock Using threads + fork() on Linux, and IO operations in the threads, the PL_perlio_mutex may be left in a locked state at the call of fork(), potentially leading to deadlock in the child process at subsequent IO operations. (Threads are pre-empted and not continued in the child process after the fork.) Therefore, ensure that the PL_perlio_mutex is unlocked in the child process, right after fork(), by using atfork_lock/unlock. (The RT text gives ways to reproduce the problem, but are not easily added to Perl's test suite) M util.c commit be33f499c408bf256e1893d4bd68dd679a35eaac Author: Karl Williamson <[email protected]> Date: Thu Mar 21 12:02:38 2013 -0600 Add Patrik Hägglund to AUTHORS M AUTHORS ----------------------------------------------------------------------- Summary of changes: AUTHORS | 1 + util.c | 6 ++++++ 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/AUTHORS b/AUTHORS index f9806c1..b448713 100644 --- a/AUTHORS +++ b/AUTHORS @@ -858,6 +858,7 @@ Patrick Donelan <[email protected]> Patrick Dugnolle <[email protected]> Patrick Hayes <[email protected]> Patrick O'Brien <[email protected]> +Patrik Hägglund <[email protected]> Pau Amma <[email protected]> Paul A Sand <[email protected]> Paul Boven <[email protected]> diff --git a/util.c b/util.c index 5c695b8..75381f1 100644 --- a/util.c +++ b/util.c @@ -2798,6 +2798,9 @@ Perl_atfork_lock(void) dVAR; #if defined(USE_ITHREADS) /* locks must be held in locking order (if any) */ +# ifdef USE_PERLIO + MUTEX_LOCK(&PL_perlio_mutex); +# endif # ifdef MYMALLOC MUTEX_LOCK(&PL_malloc_mutex); # endif @@ -2812,6 +2815,9 @@ Perl_atfork_unlock(void) dVAR; #if defined(USE_ITHREADS) /* locks must be released in same order as in atfork_lock() */ +# ifdef USE_PERLIO + MUTEX_UNLOCK(&PL_perlio_mutex); +# endif # ifdef MYMALLOC MUTEX_UNLOCK(&PL_malloc_mutex); # endif -- Perl5 Master Repository
