Closed GoogleCodeExporter closed 9 years ago
I'm not sure I understand.
Are you saying wait_procs() returns immediately even if there are still
processess to wait for?
Original comment by g.rodola
on 28 Jan 2014 at 1:02
Yes exactly. The current algorithm goes:
try:
max_timeout = 1.0 / (len(alive) - len(gone))
except ZeroDivisionError:
max_timeout = 1.0
timeout = min((deadline - timer()), max_timeout)
So whenever len(gone) > len(alive), the loop breaks and the whole method exits
prematurely. Also, the algorithm as it is now fails in its intent of having the
whole loop take a total of 1 cumulative second.
Original comment by crusade...@gmail.com
on 28 Jan 2014 at 1:16
Ah, I see what you mean. I think your patch is incorrect though in that it
needs to take ZeroDivionError into account.
AFAIU it should just be:
diff --git a/psutil/__init__.py b/psutil/__init__.py
--- a/psutil/__init__.py
+++ b/psutil/__init__.py
@@ -1272,7 +1272,7 @@
# processes may disappear in the meantime and their PID
# reused.
try:
- max_timeout = 1.0 / (len(alive) - len(gone))
+ max_timeout = 1.0 / len(alive)
except ZeroDivisionError:
max_timeout = 1.0 # one alive remaining
if timeout is not None:
Original comment by g.rodola
on 28 Jan 2014 at 1:52
Inogre my last comment about ZeroDivisionError.
I committed your patch as-is in revision 07229e0f40bd.
Thanks.
Original comment by g.rodola
on 28 Jan 2014 at 1:24
Closing out as fixed as 2.0.0 version is finally out.
Original comment by g.rodola
on 10 Mar 2014 at 11:36
Original issue reported on code.google.com by
crusade...@gmail.com
on 27 Jan 2014 at 11:40Attachments: