nikademus79 / psutil

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

Process.wait() can hog CPU resources on UNIX #244

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Apply the following change (based on r1250) and run tests

--- test/test_psutil.py (revisione 1250)
+++ test/test_psutil.py (copia locale)
@@ -581,7 +581,7 @@
         grandson_pid = int(sproc.stdout.read())
         grandson_proc = psutil.Process(grandson_pid)
         try:
-            self.assertRaises(psutil.TimeoutExpired, grandson_proc.wait, 0.01)
+            self.assertRaises(psutil.TimeoutExpired, grandson_proc.wait)
             grandson_proc.kill()
             ret = grandson_proc.wait()
             self.assertEqual(ret, None)

What is the expected output?
Normal CPU usage,

What do you see instead?
The CPU usage bumps up at 100%.

Please use labels and text to provide additional information.
wait() on POSIX uses a busy loop to check whether the process is gone.
To avoid hogging CPU resources we use a time.sleep() call but in case we 
attempt to wait() for a process which is not a children of the current one, 
time.sleep() will never get called.

Original issue reported on code.google.com by g.rodola on 19 Jan 2012 at 7:49

GoogleCodeExporter commented 8 years ago
Fixed in r1251.

Original comment by g.rodola on 19 Jan 2012 at 7:54

GoogleCodeExporter commented 8 years ago

Original comment by g.rodola on 30 Jan 2012 at 12:19

GoogleCodeExporter commented 8 years ago

Original comment by g.rodola on 20 Jun 2012 at 2:21

GoogleCodeExporter commented 8 years ago
0.5.0 is finally out. Closing out as fixed.

Original comment by g.rodola on 27 Jun 2012 at 6:54

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Updated csets after the SVN -> Mercurial migration:
r1250 == revision 4d13227f25a2
r1251 == revision 37ceb4c2eb68

Original comment by g.rodola on 2 Mar 2013 at 12:06