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 Thu, 06 Jan 2005 21:03:32 GMT
Gisle Aas wrote:
[...]
>>https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=73486
>>
>>So that is a repro case worth trying, Stas.  It just takes a while...
> 
> 
> You can speed it up my loading some other module that calls
> pthread_key_create in order to steal most of the available keys.

Thanks Gisle, the following reproduces the problem on the first restart, 
but as I've posted in the thread, I get segfaults if I try to delete the key.

Index: src/modules/perl/mod_perl.c
===================================================================
--- src/modules/perl/mod_perl.c (revision 124422)
+++ src/modules/perl/mod_perl.c (working copy)
@@ -273,6 +273,8 @@

      perl_run(perl);

+    Perl_warn(aTHX_ "ALLOC: 0x%lx\n", (unsigned long)aTHX);
+
  #ifdef USE_ITHREADS
      /* base server / virtual host w/ +Parent gets its own mip */
      modperl_interp_init(s, p, perl);
@@ -658,6 +660,20 @@
      dTHXa(scfg->mip->parent->perl);
  #endif

+    {
+        pthread_key_t key;
+        int i = 0;
+        for (i=0; i<500; i++) {
+            if (pthread_key_create(&key, 0) == 0) {
+                Perl_warn(aTHX_ "%d\n", i);
+            }
+            else {
+                Perl_croak(aTHX_ "failed to create the key");
+            }
+        }
+    }
+
+
      if (!modperl_post_config_require(s, pconf)) {
          exit(1);
      }

-- 
__________________________________________________________________
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