develooper Front page | perl.perl5.porters | Postings from July 2001

pthread_atfork problem

Thread Next
From:
Doug MacEachern
Date:
July 10, 2001 09:27
Subject:
pthread_atfork problem
Message ID:
Pine.LNX.4.21.0107100913160.1913-100000@mako.covalent.net
current bleedperl causes deadlock when using perl_clone(), since the
pthread_atfork call happens once for each clone.  it could be moved to
PERL_SYS_INIT to prevent this, but still presents a problem for mod_perl.
when apache starts it dlopen's libmodperl.so, and calls the module init
function which will call PERL_SYS_INIT and construct all the interpreters.
apache restarts itself at startup, so this happens twice at startup, then
once for each restart.
however, Perl's atfork handlers can only be registered _once_ per process,
else there is deadlock.  so in my fiddling, modperl needs to call
PTHREAD_ATFORK itself with special care so that it only happens _once_.  i
believe this will still be a problem, since pthread_atfork was given
function pointers to things in libmodperl.so which is closed/opened on
restarts and may not have the same address afterwards.  i don't see any
function to clear the atfork handlers.  might need to consider
alternatives to using pthread_atfork?


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About