perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: t/TEST t/directive/cmdparms.t segfaults w/5.8.5+ithreads
Date Fri, 08 Oct 2004 02:09:11 GMT
Joe Schaefer wrote:
> Stas Bekman <stas@stason.org> writes:
> 
> 
>>Joe Schaefer wrote:
>>
>>>Stas Bekman <stas@stason.org> 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

I wonder why do we have dTHX there. It's most likely the cause of the 
problem, as essentially it grabs the latest context that was used 
recently. It should be:

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   8 Oct 2004 02:04:48 -0000
@@ -168,7 +168,7 @@

  #ifdef USE_ITHREADS
      modperl_interp_t *interp;
-    dTHX;
+    pTHX;
  #endif

      /* if the module is loaded in vhost, base==NULL */

need to check if we have other places that use dTHX instead of pTHX

pTHX: register PerlInterpreter *my_perl
dTHX: register PerlInterpreter *my_perl = PERL_GET_THX

Could that be the problem that you see? Could you please try with my patch 
above, reversing yours first?

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