On Wed, 21 Jan 2004, Stas Bekman wrote:

> And here are two more patches to try (all against the
> fresh cvs). This is similar to one successful path that
> changes and restores context inside perldo
> (Apache::PerlSections).
>
> The first one adds the setting of the context inside modules
> (PerlModule/PerlLoadModule) though it doesn't restore it. The second one
> restores it as well.
>
> Index: src/modules/perl/modperl_cmd.c
> ===================================================================
> RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_cmd.c,v
> retrieving revision 1.52
> diff -u -r1.52 modperl_cmd.c
> --- src/modules/perl/modperl_cmd.c      19 Dec 2003 01:17:31 -0000      1.52
> +++ src/modules/perl/modperl_cmd.c      22 Jan 2004 00:55:18 -0000
> @@ -116,6 +116,7 @@
>   #ifdef USE_ITHREADS
>           /* XXX: .htaccess support cannot use this perl with threaded MPMs */
>           dTHXa(scfg->mip->parent->perl);
> +        PERL_SET_CONTEXT(aTHX);
>   #endif
>           MP_TRACE_d(MP_FUNC, "load PerlModule %s\n", arg);
>
> @@ -373,6 +374,7 @@
>   #ifdef USE_ITHREADS
>       MP_dSCFG(s);
>       pTHX;
> +    PerlInterpreter *orig_perl;
>   #endif
>
>       if (!(arg && *arg)) {
> @@ -388,7 +390,9 @@
>
>   #ifdef USE_ITHREADS
>       /* XXX: .htaccess support cannot use this perl with threaded MPMs */
> +    orig_perl = PERL_GET_CONTEXT;
>       aTHX = scfg->mip->parent->perl;
> +    PERL_SET_CONTEXT(aTHX);
>   #endif
>
>       /* data will be set by a <Perl> section */
> @@ -479,6 +483,11 @@
>           }
>       }
>
> +#ifdef USE_ITHREADS
> +    /* restore the original perl context */
> +    PERL_SET_CONTEXT(orig_perl);
> +#endif
> +
>       return NULL;
>   }
>

This patch for me, applied (manually) against the current
mp2 cvs sources and with the updated vhost test patch you
recently sent, fails for me on startup with the "free
to wrong pool" error. This is with ActivePerl 808, based
on perl-5.8.2 (with some ActiveState patches).

> The second patch:
>
> Index: src/modules/perl/modperl_cmd.c
> ===================================================================
> RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_cmd.c,v
> retrieving revision 1.52
> diff -u -r1.52 modperl_cmd.c
> --- src/modules/perl/modperl_cmd.c    19 Dec 2003 01:17:31 -0000      1.52
> +++ src/modules/perl/modperl_cmd.c    22 Jan 2004 01:07:35 -0000
> @@ -105,7 +105,10 @@
>   MP_CMD_SRV_DECLARE(modules)
>   {
>       MP_dSCFG(parms->server);
> -
> +#ifdef USE_ITHREADS
> +    PerlInterpreter *orig_perl;
> +#endif
> +
>       if (modperl_is_running() &&
>           modperl_init_vhost(parms->server, parms->pool, NULL) != OK)
>       {
> @@ -115,7 +118,9 @@
>       if (modperl_is_running()) {
>   #ifdef USE_ITHREADS
>           /* XXX: .htaccess support cannot use this perl with threaded MPMs */
> +        orig_perl = PERL_GET_CONTEXT;
>           dTHXa(scfg->mip->parent->perl);
> +        PERL_SET_CONTEXT(aTHX);
>   #endif
>           MP_TRACE_d(MP_FUNC, "load PerlModule %s\n", arg);
>
> @@ -128,6 +133,11 @@
>           *(const char **)apr_array_push(scfg->PerlModule) = arg;
>       }
>
> +#ifdef USE_ITHREADS
> +    /* restore the original perl context */
> +    PERL_SET_CONTEXT(orig_perl);
> +#endif
> +
>       return NULL;
>   }
>
> @@ -373,6 +383,7 @@
>   #ifdef USE_ITHREADS
>       MP_dSCFG(s);
>       pTHX;
> +    PerlInterpreter *orig_perl;
>   #endif
>
>       if (!(arg && *arg)) {
> @@ -388,7 +399,9 @@
>
>   #ifdef USE_ITHREADS
>       /* XXX: .htaccess support cannot use this perl with threaded MPMs */
> +    orig_perl = PERL_GET_CONTEXT;
>       aTHX = scfg->mip->parent->perl;
> +    PERL_SET_CONTEXT(aTHX);
>   #endif
>
>       /* data will be set by a <Perl> section */
> @@ -479,6 +492,11 @@
>           }
>       }
>
> +#ifdef USE_ITHREADS
> +    /* restore the original perl context */
> +    PERL_SET_CONTEXT(orig_perl);
> +#endif
> +
>       return NULL;
>   }
>

This patch wouldn't compile for me - I get the errors

        cd "src/modules/perl" && NMAKE -f Makefile.modperl

        cl -ID:/unzipped/MODPER~1.0/src/modules/perl
-ID:/unzipped/MODPER~1.0/xs -ID:\Apache2\include
-ID:/Apache2/include -nologo -Gf -W3 -MD -DNDEBUG -O1
-DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT
-DNO_HASH_SEED -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
-DUSE_PERLIO -DPERL_MSVCRT_READFIX -I"D:\Perl\lib\CORE"
-DMOD_PERL -DMP_COMPAT_1X -MD -DNDEBUG -O1 -c modperl_cmd.c
&& D:\Perl\bin\perl.exe -MExtUtils::Command -e mv
modperl_cmd.obj modperl_cmd.lo modperl_cmd.c
modperl_cmd.c(124) : error C2143: syntax error : missing ';' before 'type'
modperl_cmd.c(125) : error C2065: 'my_perl' : undeclared identifier
modperl_cmd.c(125) : warning C4022: 'Perl_set_context' :
pointer mismatch for actual parameter 1
modperl_cmd.c(129) : warning C4047: 'function' : 'struct
interpreter *' differs in levels of indirection from 'int '
modperl_cmd.c(129) : warning C4024: 'modperl_require_module'
: different types for formal and actual parameter 1
modperl_cmd.c(130) : warning C4047: 'function' : 'struct
interpreter *' differs in levels of indirection from 'int '
modperl_cmd.c(130) : warning C4024: 'Perl_Ierrgv_ptr' :
different types for formal and actual parameter 1
modperl_cmd.c(146) : error C2059: syntax error : 'const'

Does this make sense? Or might it be a mis-applied
patch (although I did double-check it).

-- 
best regards,
randy

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

Reply via email to