This queue is for tickets about the BSD-Resource CPAN distribution.

Report information
The Basics
Id:
20394
Status:
resolved
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
david [...] kineticode.com
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



CC: Dave Rolsky <autarch@urth.org>
Subject: Wrong Values Returned on Mac OS X?
Date: Mon, 10 Jul 2006 08:25:33 -0700
To: bug-bsd-resource@rt.cpan.org
From: David Wheeler <david@kineticode.com>
Hi Jarkko, In testing a new version of Apache::SizeLimit, a bunch of tests failed. Dave Rolsky, the new maintainer of that module, asked me to run: geertz% perl -MBSD::Resource -le 'print for (BSD::Resource::getrusage ())[2,3]' 0 0 It seems, however, that these values are unexpected. So is it the case that rusage() works differently on Mac OS X than on other BSDs? Or could this be a bug in BSD::Resource? Versions: Mac OS X 10.4.7 geertz% pv BSD::Resource 1.28 geertz% perl -v This is perl, v5.8.8 built for darwin-2level
Sorry, missed this ticket... but doesn't help much that I know noticed it since BSD::Resource doesn't do much beyond what the underlying system supports: if your system returns zeros from getrusage(), that's what BSD::Resource will return from getrusage. (There is one known problem in Mac OS X in this area, but it's for setrlimit() and max number of processes.) FWIW, I'm not seeing the problem in my Mac OS X, and yours is the only one, I'm afraid. Maybe there's something different about the system you are running it in, or the user you are running it as, or something like that?
Subject: Re: [rt.cpan.org #20394] Wrong Values Returned on Mac OS X?
Date: Sat, 6 Oct 2007 20:01:00 -0700
To: bug-BSD-Resource@rt.cpan.org
From: "David E. Wheeler" <david@kineticode.com>
On Oct 6, 2007, at 13:19, Jarkko_Hietaniemi via RT wrote:
Show quoted text
> Sorry, missed this ticket... but doesn't help much that I know > noticed it since BSD::Resource > doesn't do much beyond what the underlying system supports: if your > system returns zeros > from getrusage(), that's what BSD::Resource will return from > getrusage. > > (There is one known problem in Mac OS X in this area, but it's for > setrlimit() and max number of > processes.) > > FWIW, I'm not seeing the problem in my Mac OS X, and yours is the > only one, I'm afraid. Maybe > there's something different about the system you are running it in, > or the user you are running > it as, or something like that? >
Odd. I'm now using a completely different box, and I still get the same result: boas% perl -MBSD::Resource -le 'print for (BSD::Resource::getrusage()) [2,3]' 0 0 Is there some simple test I can do to see what the system actually returns? Versions: Mac OS X 10.4.10 boas% pv BSD::Resource 1.28 boas% perl -v This is perl, v5.8.8 built for darwin-2level Thanks, David
Subject: Re: [rt.cpan.org #20394] Wrong Values Returned on Mac OS X?
Date: Sun, 07 Oct 2007 08:14:08 -0400
To: bug-BSD-Resource@rt.cpan.org
From: Jarkko Hietaniemi <jhi@iki.fi>
Show quoted text
> 0 > > Is there some simple test I can do to see what the system actually > returns? >
#include <sys/resource.h> #include <stdio.h> #include <errno.h> #include <string.h> int main() { struct rusage ru; int got = getrusage(RUSAGE_SELF, &ru); int err = errno; printf("getrusage = %d\n", got); printf("errno = %d (%s)\n", err, strerror(err)); #define PRINTF_RU(t) printf("%-14s = %9ld\n", "ru.ru_"#t, ru.ru_##t) PRINTF_RU(maxrss); PRINTF_RU(ixrss); return 0; } But let's take a step back: what is it that you *expect* to be returned? When I said my system works I meant: "it returns zeros, too". In many systems the getrusage() is not that well maintained, that is, the various kernel statistics are *not* returned by getrusage(). (And most often this means the fields are and stay zero.)
Show quoted text
> Versions: > > Mac OS X 10.4.10 > > boas% pv BSD::Resource > 1.28 > boas% perl -v > > This is perl, v5.8.8 built for darwin-2level > > Thanks, > > David > >
CC: Dave Rolsky <autarch@urth.org>
Subject: Re: [rt.cpan.org #20394] Wrong Values Returned on Mac OS X?
Date: Sun, 7 Oct 2007 17:17:09 -0700
To: bug-BSD-Resource@rt.cpan.org
From: "David E. Wheeler" <david@kineticode.com>
On Oct 7, 2007, at 05:14, jhi@iki.fi via RT wrote:
Show quoted text
Show quoted text
>> Is there some simple test I can do to see what the system actually >> returns? >>
> > #include <sys/resource.h> > #include <stdio.h> > #include <errno.h> > #include <string.h> > int main() { > struct rusage ru; > int got = getrusage(RUSAGE_SELF, &ru); > int err = errno; > printf("getrusage = %d\n", got); > printf("errno = %d (%s)\n", err, strerror(err)); > #define PRINTF_RU(t) printf("%-14s = %9ld\n", "ru.ru_"#t, ru.ru_##t) > PRINTF_RU(maxrss); > PRINTF_RU(ixrss); > return 0; > } > > But let's take a step back: what is it that you *expect* to be > returned? > When I said my system works I meant: "it returns zeros, too". In many > systems the getrusage() is not that well maintained, that is, the > various kernel statistics are *not* returned by getrusage(). (And > most > often this means the fields are and stay zero.)
I dunno. Dave? This was related to something with Apache::SizeLimit, and it was Rolsky who seemed to think that the 0s were a bug. Best, David
Subject: Re: [rt.cpan.org #20394] Wrong Values Returned on Mac OS X?
Date: Sun, 07 Oct 2007 21:06:46 -0400
To: bug-BSD-Resource@rt.cpan.org
From: Jarkko Hietaniemi <jhi@iki.fi>
Show quoted text
>> returns?
>>>
>> #include <sys/resource.h> >> #include <stdio.h> >> #include <errno.h> >> #include <string.h> >> int main() { >> struct rusage ru; >> int got = getrusage(RUSAGE_SELF, &ru); >> int err = errno; >> printf("getrusage = %d\n", got); >> printf("errno = %d (%s)\n", err, strerror(err)); >> #define PRINTF_RU(t) printf("%-14s = %9ld\n", "ru.ru_"#t, ru.ru_##t) >> PRINTF_RU(maxrss); >> PRINTF_RU(ixrss); >> return 0; >> } >> >> But let's take a step back: what is it that you *expect* to be >> returned? >> When I said my system works I meant: "it returns zeros, too". In many >> systems the getrusage() is not that well maintained, that is, the >> various kernel statistics are *not* returned by getrusage(). (And >> most >> often this means the fields are and stay zero.)
> > I dunno. Dave? This was related to something with Apache::SizeLimit, > and it was Rolsky who seemed to think that the 0s were a bug.
Tried the above in four different Unixes, only one of them reported non-zero (for maxrss), ixrss stayed zero in all of them.
Show quoted text
> Best, > > David > > >
CC: bug-BSD-Resource@rt.cpan.org
Subject: Re: [rt.cpan.org #20394] Wrong Values Returned on Mac OS X?
Date: Sun, 7 Oct 2007 20:52:10 -0500 (CDT)
To: "David E. Wheeler" <david@kineticode.com>
From: Dave Rolsky <autarch@urth.org>
On Sun, 7 Oct 2007, David E. Wheeler wrote:
Show quoted text
>> But let's take a step back: what is it that you *expect* to be returned? >> When I said my system works I meant: "it returns zeros, too". In many >> systems the getrusage() is not that well maintained, that is, the >> various kernel statistics are *not* returned by getrusage(). (And most >> often this means the fields are and stay zero.)
> > I dunno. Dave? This was related to something with Apache::SizeLimit, and it > was Rolsky who seemed to think that the 0s were a bug.
Well, Apache::SizeLimit uses BSD::Resource on systems where that's the right thing to use. If BSD::Resource can't return any useful values about memory usage, I'll leave it to the BSD::Resource maintainer to declare it not a bug ;) That may just mean that the Apache::SizeLimit tests need adjusting, but ultimately it means Apache::SizeLimit probably won't work on the given platform(s). -dave
Subject: Re: [rt.cpan.org #20394] Wrong Values Returned on Mac OS X?
Date: Wed, 10 Oct 2007 11:49:32 -0700
To: bug-BSD-Resource@rt.cpan.org
From: "David E. Wheeler" <david@kineticode.com>
On Oct 7, 2007, at 18:07, jhi@iki.fi via RT wrote:
Show quoted text
>> I dunno. Dave? This was related to something with Apache::SizeLimit, >> and it was Rolsky who seemed to think that the 0s were a bug.
> > Tried the above in four different Unixes, only one of them reported > non-zero (for maxrss), ixrss stayed zero in all of them.
Heya Jarkko, id you hear back from Dave directly? Thanks, David
On Wed Oct 10 14:53:29 2007, david@kineticode.com wrote:
Show quoted text
> On Oct 7, 2007, at 18:07, jhi@iki.fi via RT wrote: >
> >> I dunno. Dave? This was related to something with Apache::SizeLimit, > >> and it was Rolsky who seemed to think that the 0s were a bug.
> > > > Tried the above in four different Unixes, only one of them reported > > non-zero (for maxrss), ixrss stayed zero in all of them.
> > Heya Jarkko, id you hear back from Dave directly?
FWIW, I just ran perl -MBSD::Resource -le 'print for (BSD::Resource::getrusage ())[2,3]' 3039232 0 So does that mean that the issue has been fixed somewhere? Perhaps on a newer version of OS X (I'm running 10.6.4 now)? David
I think this has been irrevocably fixed in OS X.


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.