Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
giampaolo opened this issue May 23, 2014 · 5 comments
Closed

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

giampaolo opened this issue May 23, 2014 · 5 comments

Comments

@giampaolo
Copy link
Owner

From g.rodola on January 19, 2012 20:49:23

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: http://code.google.com/p/psutil/issues/detail?id=244

@giampaolo giampaolo self-assigned this May 23, 2014
@giampaolo
Copy link
Owner Author

From g.rodola on January 19, 2012 11:54:12

Fixed in r1251 .

Status: FixedInSVN

@giampaolo
Copy link
Owner Author

From g.rodola on January 30, 2012 04:19:51

Labels: Milestone-0.5.0

@giampaolo
Copy link
Owner Author

From g.rodola on June 19, 2012 19:21:16

Labels: -Priority-Medium Priority-High

@giampaolo
Copy link
Owner Author

From g.rodola on June 27, 2012 11:54:03

0.5.0 is finally out. Closing out as fixed.

Status: Fixed

@giampaolo
Copy link
Owner Author

From g.rodola on March 02, 2013 04:06:35

Updated csets after the SVN -> Mercurial migration: r1250 == revision 
4d13227f25a2 r1251 == revision 37ceb4c2eb68

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant