Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 277 by
shane.c....@gmail.com: Monitoring Java Servers On Mac OS
Lion Causes Monitored Server To Segfault
http://code.google.com/p/psutil/issues/detail?id=277
What steps will reproduce the problem?
Running the following code to monitor a Java based server on Mac OS Lion
causes the monitored server to seg fault. I tried this with several
industrial grade servers (ActiveMQ, Tomcat etc) and each time the server
crashed after several minutes when the script is run on five second loop.
I want to be clear - it is not the python script that fails - it is the
java server process that is being monitored that consistently segfaults. I
tried with non-java processes (firefox etc) and did not observe the same
behavior.
{{{
#!/usr/bin/env python
import psutil
import sys
proc = None;
#find the server we are looking for
for ps in psutil.process_iter():
#print
ps.name
try:
if(
ps.name == "java" ):
for cmd in ps.cmdline:
if cmd.count("apache-activemq-5.4.2") > 0:
proc = ps;
break
if proc is not None:
break
except Exception, e:
pass
if not proc:
print "SERVER NOT RUNNING..."
sys.exit(1)
print " CPU: {0:15.1f}%".format(proc.get_cpu_percent())
print " U Time: {0:15.1f}s".format(proc.get_cpu_times().user)
print " S Time: {0:15.1f}s".format(proc.get_cpu_times().system)
print " Memory: {0:15.1f}%".format(proc.get_memory_percent())
print " Threads:{0:13d}".format( proc.get_num_threads() )
print " Files: {0:13d}".format( len(proc.get_open_files()) )
print " INET: {0:13d}".format( len(proc.get_connections()) )
}}}
What is the expected output?
The service being monitored should continue to run
What do you see instead?
Segmentation fault: 11
What version of psutil are you using? What Python version?
psutil 0.4.1
python 2.7
On what operating system? Is it 32bit or 64bit version?
Mac Lion - 64 bit
Please provide any additional information below.