Stas Bekman <[EMAIL PROTECTED]> writes:

> Joe Schaefer wrote:
> > Stas Bekman <[EMAIL PROTECTED]> writes:
> > [...]
> >
> >>Joe, this still needs to applied? But please make sure that you
> >>restore the context when you are done with it. Look at the other
> >>places where this is done (grep for SET_CONTEXT).
> > AFAICT the only place where the context is "localized" is in modperl_cmd.c:
> > #define MP_PERL_DECLARE_CONTEXT \
> >     PerlInterpreter *orig_perl; \
> >     pTHX;
> > /* XXX: .htaccess support cannot use this perl with threaded MPMs */
> > #define MP_PERL_OVERRIDE_CONTEXT    \
> >     orig_perl = PERL_GET_CONTEXT;   \
> >     aTHX = scfg->mip->parent->perl; \
> >     PERL_SET_CONTEXT(aTHX);
> > #define MP_PERL_RESTORE_CONTEXT     \
> >     PERL_SET_CONTEXT(orig_perl);
> > Is that what you have in mind here?
> 
> Exactly.

Here's the patch- unfortunately it doesn't quite work...
I get a similar segfault when the perl handler runs
(this patch only affects modperl_module_config_merge).

Index: src/modules/perl/modperl_module.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_module.c,v
retrieving revision 1.17
diff -u -r1.17 modperl_module.c
--- src/modules/perl/modperl_module.c   4 Mar 2004 06:01:07 -0000       1.17
+++ src/modules/perl/modperl_module.c   7 Oct 2004 18:50:57 -0000
@@ -169,6 +169,7 @@
 #ifdef USE_ITHREADS
     modperl_interp_t *interp;
     dTHX;
+    PerlInterpreter *orig_perl = aTHX;
 #endif

     /* if the module is loaded in vhost, base==NULL */
@@ -185,6 +186,7 @@
 #ifdef USE_ITHREADS
     interp = modperl_interp_pool_select(p, s);
     aTHX = interp->perl;
+    PERL_SET_CONTEXT(aTHX);
 #endif

     table = modperl_module_config_table_get(aTHX_ TRUE);
@@ -239,7 +241,7 @@
     if (!is_startup) {
         modperl_module_config_obj_cleanup_register(aTHX_ p, table, mrg);
     }
-
+    PERL_SET_CONTEXT(orig_perl);
     return (void *)mrg;
 }


~>

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1099901296 (LWP 5305)]
0x0000002a967c286d in Perl_safesysmalloc (size=96) at util.c:75
(gdb) up
#1  0x0000002a967f01d7 in Perl_sv_upgrade (my_perl=0x14204c0, sv=0x1490250, mt=13)
    at sv.c:1506
(gdb) 

#2  0x0000002a96764286 in Perl_gv_init (my_perl=0x14204c0, gv=0x1490250, 
    stash=0x2fa2720, name=0x2a968b2e45 "DESTROY", len=7, multi=1) at gv.c:112
(gdb) #3  0x0000002a96764807 in Perl_gv_fetchmeth (my_perl=0x14204c0, stash=0x2fa2720, 
    name=0x2a968b2e45 "DESTROY", len=7, level=0) at gv.c:225
(gdb) 
#4  0x0000002a96764e47 in Perl_gv_fetchmeth_autoload (my_perl=0x14204c0, 
    stash=0x2fa2720, name=0x2a968b2e45 "DESTROY", len=7, level=0) at gv.c:338
(gdb) 
#5  0x0000002a967681db in Perl_Gv_AMupdate (my_perl=0x14204c0, stash=0x2fa2720)
    at gv.c:1363
(gdb) 
#6  0x0000002a96801108 in Perl_sv_bless (my_perl=0x14204c0, sv=0x1490230, 
    stash=0x2fa2720) at sv.c:7894
(gdb) 
#7  0x0000002a96800e34 in Perl_newSVrv (my_perl=0x14204c0, rv=0x1490230, 
    classname=0x2a96615908 "Apache::RequestRec") at sv.c:7748
(gdb) 
#8  0x0000002a96800ea6 in Perl_sv_setref_pv (my_perl=0x14204c0, rv=0x1490230, 
    classname=0x2a96615908 "Apache::RequestRec", pv=0x274a6a8) at sv.c:7779
(gdb) 
#9  0x0000002a965f9576 in modperl_ptr2obj (my_perl=0x14204c0, 
    classname=0x2a96615908 "Apache::RequestRec", ptr=0x274a6a8)
    at modperl_util.c:192
(gdb) 
#10 0x0000002a965f7d99 in modperl_handler_make_args (my_perl=0x14204c0, 
    avp=0x418f2158) at modperl_handler.c:238
(gdb) 
#11 0x0000002a965f6c23 in modperl_callback_run_handlers (idx=6, type=4, 
    r=0x274a6a8, c=0x0, s=0x5a0b80, pconf=0x0, plog=0x0, ptemp=0x0, 
    run_mode=MP_HOOK_RUN_FIRST) at modperl_callback.c:237



-- 
Joe Schaefer


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to