[mp2] Apache2::SizeLimit should be using $s->rss, not $s->size for Linux::Smaps

Max Kanat-Alexander <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Organization Bugzilla Project
Message-ID <[email protected]>
	All of my processes kept exiting with a report that they had a 300M
unshared size, which was clearly untrue, even from looking at top. After
some investigation, I discovered that Apache2::SizeLimit was calling
$s->size on the Linux::Smaps object, when instead it should be returning
$s->rss as the process size.

	Attached is a one-line patch to fix the issue.

	Also, if you're interested in proof that this is right, I've attached a
short .cgi file that you can load under mod_perl, with Linux::Smaps
installed, to see process sizes and the return values of all of the
Smaps accessors.

	-Max
-- 
http://www.everythingsolved.com/
Competent, Friendly Bugzilla and Perl Services. Everything Else, too.
size-smaps.diff (text/plain, 376 B)
--- Apache2/SizeLimit.pm.old	2010-02-02 15:53:22.000000000 -0600
+++ Apache2/SizeLimit.pm	2010-02-02 15:50:11.000000000 -0600
@@ -111,7 +111,7 @@
 sub linux_smaps_size_check {
 
     my $s = Linux::Smaps->new($$)->all;
-    return ($s->size, $s->shared_clean + $s->shared_dirty);
+    return ($s->rss, $s->shared_clean + $s->shared_dirty);
 }
 
 # return process size (in KB)
test.cgi (text/plain, 362 B)
#!/usr/bin/perl -wT
use strict;
use warnings;
use Linux::Smaps;

my $s = Linux::Smaps->new($$)->all;
print "Content-type: text/plain\n\n";
print "SIZE: " . $s->size, "\n";
print "CLEAN: ", $s->shared_clean, " DIRTY: ", $s->shared_dirty, "\n";
print "PRIVATE CLEAN: ", $s->private_clean, " PRIVATE DIRTY: ", $s->private_dirty, "\n";
print "RSS: ", $s->rss, "\n";
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.