perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: [mp2] Problem with custom config in Location
Date Fri, 20 May 2005 22:29:50 GMT
Stas Bekman wrote:
> Herve Guillemet wrote:
> 
>> New report:
> 
> [...]
> 
>> #22 0x08066b3d in worker_thread (thd=0x8231f18, dummy=0x0) at 
>> worker.c:835
>> #23 0x4010f2f1 in dummy_worker (opaque=0x0) at thread.c:105
>> #24 0x4019a54e in pthread_start_thread () from /lib/libpthread.so.0
>> #25 0x402a3b8a in clone () from /lib/libc.so.6
> 
> 
> Thanks for the perfect report, Herve :)
> 
> I'm now able to reproduce the problem with worker. I was first tested it 
> with prefork which worked just fine. I'm looking at it.

Herve, you've uncovered a bloody global perl context switch bug. Please 
try this patch (the reproducing tar ball now works for me under worker)

Index: src/modules/perl/modperl_module.c
===================================================================
--- src/modules/perl/modperl_module.c	(revision 171124)
+++ src/modules/perl/modperl_module.c	(working copy)
@@ -165,10 +165,9 @@
      int is_startup;
      PTR_TBL_t *table;
      SV *mrg_obj = Nullsv, *base_obj, *add_obj;
-
  #ifdef USE_ITHREADS
+    MP_PERL_CONTEXT_DECLARE;
      modperl_interp_t *interp;
-    pTHX;
  #endif

      /* if the module is loaded in vhost, base==NULL */
@@ -184,7 +183,7 @@

  #ifdef USE_ITHREADS
      interp = modperl_interp_pool_select(p, s);
-    aTHX = interp->perl;
+    MP_PERL_CONTEXT_STORE_OVERRIDE(interp->perl);
  #endif

      table = modperl_module_config_table_get(aTHX_ TRUE);
@@ -240,6 +239,11 @@
          modperl_module_config_obj_cleanup_register(aTHX_ p, table, mrg);
      }

+#ifdef USE_ITHREADS
+    modperl_interp_unselect(interp);
+    MP_PERL_CONTEXT_RESTORE;
+#endif
+
      return (void *)mrg;
  }



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

Mime
View raw message