As I've suspected our API is not perl thread-safe (note that perl's thread-safe definition and the general thread-safe concept have little to do with each other). I've started writing some tests and it's segfaults all over.
Here is a very trivial test, which segfault:
#!perl -T
use strict; use warnings FATAL => 'all';
use threads;
use APR::Pool ();
use Config;
use constant THREADS_OK => $] >= 5.008 && $Config{useithreads};
die "perl w/ ithreads is required" unless THREADS_OK;our $p = APR::Pool->new; my $threads = 2;
threads->new(sub {}) for 1..$threads;$_->join() for threads->list();
#----------------
here $p is cloned by perl twice (2 threads started), so now we have 3 perl objects all pointing at the same APR pool. Obviously at the end of script, each is trying to destroy the pool. The first succeeds, the next two segfault (in fact I've observed that only the third segfaults). Note that it's not enough to somehow mark the clones as not destructable. Even if we avoid the crash at the shutdown, we now get into the real C thread-safeness where the same pool object will be accessed by various threads w/o any locking. And even if we add locking, the parent thread may go out of scope before the child threads (which can be detached), in which case the carpet will be pulled from under all the objects created from that pool....
-- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
