In a client control file calling a lot of times of job.run_test(), the
system's pid_max could be reached and the pids are recycled for the
tests run in child processes, causing the parent process mistakenly
determines the status of the child test.

This change fixes the problem by renaming the serialized
client/results/default/debug/error-pid file so that they are not seen by
the parent process after first use.

Signed-off-by: Jinxin Zheng <[email protected]>
---
 client/bin/parallel.py |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/client/bin/parallel.py b/client/bin/parallel.py
index cae897f..1ecc75f 100644
--- a/client/bin/parallel.py
+++ b/client/bin/parallel.py
@@ -51,7 +51,17 @@ def fork_start(tmp, l):
 def _check_for_subprocess_exception(temp_dir, pid):
     ename = temp_dir + "/debug/error-%d" % pid
     if os.path.exists(ename):
-        raise pickle.load(file(ename, 'r'))
+        e = pickle.load(file(ename, 'r'))
+        # rename the error-pid file so that they do not affect later child
+        # processes that use recycled pids.
+        i = 0
+        while True:
+            pename = ename + ('-%d' % i)
+            i += 1
+            if not os.path.exists(pename):
+                break
+        os.rename(ename, pename)
+        raise e
 
 
 def fork_waitfor(tmp, pid):
-- 
1.6.6.1

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to