Return-Path: Delivered-To: apmail-perl-dev-archive@www.apache.org Received: (qmail 95096 invoked from network); 5 Jan 2005 18:40:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 5 Jan 2005 18:40:39 -0000 Received: (qmail 19214 invoked by uid 500); 5 Jan 2005 18:40:34 -0000 Delivered-To: apmail-perl-dev-archive@perl.apache.org Received: (qmail 19170 invoked by uid 500); 5 Jan 2005 18:40:33 -0000 Mailing-List: contact dev-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list dev@perl.apache.org Received: (qmail 19131 invoked by uid 99); 5 Jan 2005 18:40:33 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from mail.logilune.com (HELO mail.logilune.com) (195.80.154.36) by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 05 Jan 2005 10:40:30 -0800 Received: from [127.0.0.1] (localhost.logilune.com [127.0.0.1]) by mail.logilune.com (Postfix) with ESMTP id 1BCD71E1A12; Wed, 5 Jan 2005 19:40:25 +0100 (CET) Message-ID: <41DC3498.5090608@stason.org> Date: Wed, 05 Jan 2005 13:40:24 -0500 From: Stas Bekman Organization: Hope, Humanized User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041217 X-Accept-Language: en-us, en, he, ru MIME-Version: 1.0 To: Gisle Aas Cc: mod_perl Dev Subject: Re: [Fwd: [PATCH] libperl leaks a THREAD_KEY each time it is reloaded] References: <41DC1C96.2030701@stason.org> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Gisle Aas wrote: > Stas Bekman 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 and 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