perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: [Fwd: [PATCH] libperl leaks a THREAD_KEY each time it is reloaded]
Date Wed, 05 Jan 2005 18:40:24 GMT
Gisle Aas wrote:
> Stas Bekman <stas@stason.org> writes:
> 
> 
>>Gisle, could you please provide us some more details about the crash?
> 
> 
> I don't really know much more.  I have not tried to reproduce this
> problem myself with mod_perl and I don't even know exactly which
> version of httpd and mod_perl was in use.
> 
> This is the (only) information I got from HP (our customer) about this
> problem:
> ----------------------------------------------------------------------
> Our customer is using httpd, with mod_perl enabled.  Repeated restart
> of this httpd results in the "panic: pthread_key_create" error.
> 
> Working on it, we have found out that each time httpd is restarted it
> rereads the configuration file, httpd.conf. And everytime, the specified
> LoadModule directive is also read. This loads the DSO, mod_perl.so. mod_perl
> calls perl_alloc() from libperl.a, for allocating the memory for the
> Interpreter.

OK, so it looks like mp2 DSO. It's not clear if it's a worker or prefork 
(but most likely a worker, unless they decided to use interpreter pools 
with prefork, which is possible too).

> As Jan told me in the previous mail, thread private data is created
> only once for a process.  Therefore it is not deleted anywhere.
> 
> However, everytime mod_perl.so is reloaded, PL_curinterp gets initialised to
> 0. So, everytime the thread private data is created. When the limit to the
> number of thread private data to be created per process is crossed reached,
> it does exit(), making httpd to EXIT.
> 
> We have attached 2 files <test.c> and <t.c> with behaviours similar to
> mod_perl and httpd respectively.
> 
> Isn't there any way to free this storage allocated by the library call?
> ----------------------------------------------------------------------
> 
> The sited patch apparently made the customer happy and I did not ask
> more questions since we had the smaller test case to work from.
> 
> On my Linux box a process might allocate 1024 thread keys before
> pthread_key_create fails.  It means that you would have to restart
> httpd that many times before it crashes.  This customer was running
> HP-UX where the limit is 256 thread keys before the allocator starts
> to fail.

How do I check the limit for pthread_key_create on linux? Is there a way 
to check that dynamically (i.e. how much is already used)? I'll try to 
reproduce it.

I suppose modperl could provide a workaround for older perls, based on 
your patch?

At the very least I want to log it in the troubleshooting docs and point 
users to the perl version that has this bug fixed.


-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message