patch for Apache2::SizeLimit under solaris 10
Hello, Here is a patch for Apache2::SizeLimit under solaris 10, apache 2.2, unthreaded prefork model : diff -c ./mod_perl-2.0.4/blib/lib/Apache2/SizeLimit.pm ./SizeLimit.pm *** ./mod_perl-2.0.4/blib/lib/Apache2/SizeLimit.pm Mon Dec 6 15:59:43 2010 --- ./SizeLimit.pm Mon Dec 6 18:41:04 2010 *** *** 52,58 if Apache2::MPM->is_threaded(); # decide at compile time how to check for a process' memory size. ! if (SOLARIS && $Config{'osvers'} >= 2.6) { $HOW_BIG_IS_IT = \&solaris_2_6_size_check; --- 52,58 if Apache2::MPM->is_threaded(); # decide at compile time how to check for a process' memory size. ! if (SOLARIS && $Config{'osvers'} >= 2.6 || $Config{'osvers'} == 2.10) { $HOW_BIG_IS_IT = \&solaris_2_6_size_check; *** *** 133,139 sub solaris_2_6_size_check { my $file = "/proc/self/as"; ! my $size = -s $file or &error_log("Fatal Error: $file doesn't exist or is empty"); $size = int($size / 1024); # in Kb return ($size, 0); --- 133,141 sub solaris_2_6_size_check { my $file = "/proc/self/as"; ! my $file2 = "/proc/$$/as"; ! my $size = undef; ! $size = -s $file or $size = -s $file2 or &error_log("Fatal Error: $file doesn't exist or is empty"); $size = int($size / 1024); # in Kb return ($size, 0); Solaris 10 seems to no longer support /proc/self/as (or perhaps just not in a non-global zone / container) It does support "/proc//as" though, pretty much in the same manner as 2.8. So the thought is just to try both. The osver conditional breaks after solaris 9, as for Solaris 10 the version is set to 2.10, which is < 2.6 (floating point). Cheers Brett
Re: patch for Apache2::SizeLimit under solaris 10
What version of SizeLimit were you using? This was fixed in svn in r882407, which was released in 0.93 in October Adam On 12/6/2010 4:11 AM, Brett @Google wrote: Hello, Here is a patch for Apache2::SizeLimit under solaris 10, apache 2.2, unthreaded prefork model : diff -c ./mod_perl-2.0.4/blib/lib/Apache2/SizeLimit.pm ./SizeLimit.pm *** ./mod_perl-2.0.4/blib/lib/Apache2/SizeLimit.pm Mon Dec 6 15:59:43 2010 --- ./SizeLimit.pm Mon Dec 6 18:41:04 2010 *** *** 52,58 if Apache2::MPM->is_threaded(); # decide at compile time how to check for a process' memory size. ! if (SOLARIS && $Config{'osvers'} >= 2.6) { $HOW_BIG_IS_IT = \&solaris_2_6_size_check; --- 52,58 if Apache2::MPM->is_threaded(); # decide at compile time how to check for a process' memory size. ! if (SOLARIS && $Config{'osvers'} >= 2.6 || $Config{'osvers'} == 2.10) { $HOW_BIG_IS_IT = \&solaris_2_6_size_check; *** *** 133,139 sub solaris_2_6_size_check { my $file = "/proc/self/as"; ! my $size = -s $file or &error_log("Fatal Error: $file doesn't exist or is empty"); $size = int($size / 1024); # in Kb return ($size, 0); --- 133,141 sub solaris_2_6_size_check { my $file = "/proc/self/as"; ! my $file2 = "/proc/$$/as"; ! my $size = undef; ! $size = -s $file or $size = -s $file2 or &error_log("Fatal Error: $file doesn't exist or is empty"); $size = int($size / 1024); # in Kb return ($size, 0); Solaris 10 seems to no longer support /proc/self/as (or perhaps just not in a non-global zone / container) It does support "/proc//as" though, pretty much in the same manner as 2.8. So the thought is just to try both. The osver conditional breaks after solaris 9, as for Solaris 10 the version is set to 2.10, which is < 2.6 (floating point). Cheers Brett
Re: Custom directive and - bug?
On 10-11-30 07:51 , "Alex J. G. Burzyński" wrote: > Hi, > > I've noticed that when using custom directives within nested > the result of $r->location reports the parent one only, instead of the > subdir. > > However if I add PerlSetVar the $r->location will report the correct one. Yup, you've stumbled on an interesting bug. > The way to replicate: > please follow the example > http://perl.apache.org/docs/2.0/user/config/custom.html#Merging_at_Work > > and now add: > > --- httpd.conf-orig2010-11-30 12:06:57.491843181 + > +++ httpd.conf2010-11-30 12:07:39.217629859 + > @@ -18,6 +18,7 @@ > PerlResponseHandler MyApache2::CustomDirectivesTest > > > +PerlSetVar fix "problem" > MyPlus 1 > MyList "SubDir" > MyAppend "SubDir" The reason this makes a difference is that without it, there are no mod_perl directives (the custom ones are 'special'), so no configuration pass for modperl in that directory. Side-effect of that is that $r->location isn't tracked proprely. Keep in mind that r->location is not an httpd api, but rather something convenient mod_perl tracks. But not in this case, unfortunately. -- Philippe M. Chiasson GPG: F9BFE0C2480E7680 1AE53631CB32A107 88C3A5A5 http://gozer.ectoplasm.org/ m/gozer\@(apache|cpan|ectoplasm)\.org/ signature.asc Description: OpenPGP digital signature
Re: Custom directive and - bug?
On 06/12/10 20:39, Philippe M. Chiasson wrote: On 10-11-30 07:51 , "Alex J. G. Burzyński" wrote: Hi, I've noticed that when using custom directives within nested the result of $r->location reports the parent one only, instead of the subdir. However if I add PerlSetVar the $r->location will report the correct one. Yup, you've stumbled on an interesting bug. I've found this while working on Apache2::Layer (on cpan) The way to replicate: please follow the example http://perl.apache.org/docs/2.0/user/config/custom.html#Merging_at_Work and now add: --- httpd.conf-orig2010-11-30 12:06:57.491843181 + +++ httpd.conf2010-11-30 12:07:39.217629859 + @@ -18,6 +18,7 @@ PerlResponseHandler MyApache2::CustomDirectivesTest +PerlSetVar fix "problem" MyPlus 1 MyList "SubDir" MyAppend "SubDir" The reason this makes a difference is that without it, there are no mod_perl directives (the custom ones are 'special'), so no configuration pass for modperl in that directory. Side-effect of that is that $r->location isn't tracked proprely. Keep in mind that r->location is not an httpd api, but rather something convenient mod_perl tracks. But not in this case, unfortunately. If you take a look at those (around lines 68-70): http://pastebin.com/PUtcczwA (with PerlSetVar) http://pastebin.com/kfjMtZsT (without PerlSetVar) you'll see that PerlSetVar creates directory context, while custom directive on its own does not. However the Apache2::CmdParams->path returns the correct value and that's what I'm using in my module as a workaround. Thanks, Alex