tigerneil / psutil

Automatically exported from code.google.com/p/psutil
Other
0 stars 0 forks source link

-02 optimization causes NoSuchProcess exception (FreeBSD) #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Compile psutil with -O2 enabled
2. Run the test suite or psutil.py
3. NoSuchProcess exception thrown for *any* PID, caused by sysctl returning
ESRC for every PID passed to it.

What is the expected output? What do you see instead?
Process information should be printed as it is normally. Instead
NoSuchProcess is raised, caused by ESRCH error from sysctl regardless of PID

Original issue reported on code.google.com by jlo...@gmail.com on 25 Feb 2009 at 2:59

GoogleCodeExporter commented 9 years ago
It took me *hours* to figure this out last night because the test code worked 
just
fine until I compiled it with distutils. I finally caught on that the only thing
different about the code (after checking it line by line 100 times) was how it 
was
compiled. I took the compiler output line from the distutils build and tried 
building
a test C app with it, and got the same "No such process" error from sysctl 
until I
removed -O2 optimization.

For now, I fixed this by removing the -O2 flag from my Python Makefile, but 
ideally
I'd like to either patch the C code, or setup.py to override -O2 so that this 
doesn't
bite someone else building on FreeBSD. Potentially this code might also affect 
OS X
or other platforms where we're compiling from C source code, not sure without 
testing
them individually.

Original comment by jlo...@gmail.com on 25 Feb 2009 at 3:26

GoogleCodeExporter commented 9 years ago
Fixed in r169 - caused by a int -> siz_t cast. The same cast is used in the OS 
X code
without appearing to cause any problems but that may be worth examining for 
potential
problems at a later date.

Original comment by jlo...@gmail.com on 25 Feb 2009 at 4:38

GoogleCodeExporter commented 9 years ago

Original comment by billiej...@gmail.com on 17 Mar 2009 at 3:31

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Updated csets after the SVN -> Mercurial migration:
r169 == revision 34b200f0ed15

Original comment by g.rodola on 2 Mar 2013 at 11:44