Author: stas
Date: Fri May 20 19:58:13 2005
New Revision: 171189
URL: http://svn.apache.org/viewcvs?rev=171189&view=rev
Log:
fix the half-baked fix and extend the test
Modified:
perl/modperl/trunk/Changes
perl/modperl/trunk/src/modules/perl/modperl_module.c
perl/modperl/trunk/t/response/TestDirective/perlloadmodule7.pm
Modified: perl/modperl/trunk/Changes
URL:
http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?rev=171189&r1=171188&r2=171189&view=diff
==============================================================================
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Fri May 20 19:58:13 2005
@@ -12,10 +12,12 @@
=item 2.0.1-dev
-Fix a bug in custom directive implementation, where a custom directive
-placed into a dir container was causing a global perl context change
-which was leading to a segfault in any handler called
-thereafter. [Stas]
+Fix a bug in custom directive implementation, where the code called
+from modperl_module_config_merge() was setting the global context
+after selecting the new interpreter which was leading to a segfault in
+any handler called thereafter, whose context was different
+beforehand. [Stas]
+
=item 2.0.0 - May 20, 2005
Modified: perl/modperl/trunk/src/modules/perl/modperl_module.c
URL:
http://svn.apache.org/viewcvs/perl/modperl/trunk/src/modules/perl/modperl_module.c?rev=171189&r1=171188&r2=171189&view=diff
==============================================================================
--- perl/modperl/trunk/src/modules/perl/modperl_module.c (original)
+++ perl/modperl/trunk/src/modules/perl/modperl_module.c Fri May 20 19:58:13
2005
@@ -191,6 +191,12 @@
add_obj = modperl_svptr_table_fetch(aTHX_ table, add);
if (!base_obj || (base_obj == add_obj)) {
+#ifdef USE_ITHREADS
+ modperl_interp_unselect(interp);
+ if (orig_perl) {
+ MP_PERL_CONTEXT_RESTORE;
+ }
+#endif
return addv;
}
@@ -241,7 +247,9 @@
#ifdef USE_ITHREADS
modperl_interp_unselect(interp);
- MP_PERL_CONTEXT_RESTORE;
+ if (orig_perl) {
+ MP_PERL_CONTEXT_RESTORE;
+ }
#endif
return (void *)mrg;
Modified: perl/modperl/trunk/t/response/TestDirective/perlloadmodule7.pm
URL:
http://svn.apache.org/viewcvs/perl/modperl/trunk/t/response/TestDirective/perlloadmodule7.pm?rev=171189&r1=171188&r2=171189&view=diff
==============================================================================
--- perl/modperl/trunk/t/response/TestDirective/perlloadmodule7.pm (original)
+++ perl/modperl/trunk/t/response/TestDirective/perlloadmodule7.pm Fri May 20
19:58:13 2005
@@ -1,7 +1,11 @@
package TestDirective::perlloadmodule7;
-# in this test we test an early mod_perl startup caused by an
-# EXEC_ON_READ directive in vhost.
+# this test was written to reproduce a segfault under worker
+# due to a bug in custom directive implementation, where
+# the code called from modperl_module_config_merge() was setting the
+# global context after selecting the new interpreter which was leading
+# to a segfault in any handler called thereafter, whose context was
+# different beforehand.
use strict;
use warnings FATAL => 'all';
@@ -10,15 +14,21 @@
use Apache2::Const -compile => qw(OK);
-use constant KEY => "MyTest7";
+use constant KEY1 => "MyTest7_1";
+use constant KEY2 => "MyTest7_2";
-my @directives = ({ name => +KEY },);
+my @directives = ({ name => +KEY1 }, { name => +KEY2 });
Apache2::Module::add(__PACKAGE__, [EMAIL PROTECTED]);
-sub MyTest7 {
+sub MyTest7_1 {
my($self, $parms, $arg) = @_;
- $self->{+KEY} = $arg;
+ $self->{+KEY1} = $arg;
+}
+
+sub MyTest7_2 {
+ my($self, $parms, $arg) = @_;
+ $self->{+KEY2} = $arg;
}
### response handler ###
@@ -48,8 +58,9 @@
# APACHE_TEST_CONFIG_ORDER 950
PerlLoadModule TestDirective::perlloadmodule7
+MyTest7_1 test
<Location /TestDirective__perlloadmodule7>
- MyTest7 test
+ MyTest7_2 test
SetHandler modperl
PerlResponseHandler TestDirective::perlloadmodule7
</Location>