Re: [mp2] Problem with custom config in Location

[prev] [thread] [next] [Date index for 2005/05/20]

From: Stas Bekman
Subject: Re: [mp2] Problem with custom config in Location
Date: 22:29 on 20 May 2005
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@xxxxxx.xxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

(message missing)

[mp2] Problem with custom config in Location
Herve Guillemet 19:41 on 19 May 2005

Re: [mp2] Problem with custom config in Location
Herve Guillemet 07:57 on 20 May 2005

Re: [mp2] Problem with custom config in Location
Herve Guillemet 16:09 on 20 May 2005

Re: [mp2] Problem with custom config in Location
Stas Bekman 22:29 on 20 May 2005

Re: [mp2] Problem with custom config in Location
Herve Guillemet 23:16 on 20 May 2005

Re: [mp2] Problem with custom config in Location
Herve Guillemet 13:52 on 21 May 2005

Re: [mp2] Problem with custom config in Location
Herve Guillemet 20:30 on 21 May 2005

Generated at 15:53 on 25 May 2005 by mariachi v0.52