Changeset: 5d7d47ec90d4 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5d7d47ec90d4
Modified Files:
        testing/src/Mtest.py.in
Branch: Oct2010
Log Message:

Print timeout message earlier to avoid race condition.
Since the killing happens in a separate thread, the main thread may
close the outfile before we get to writing to it in the killProc thread.


diffs (25 lines):

diff -r 5000b29c0206 -r 5d7d47ec90d4 testing/src/Mtest.py.in
--- a/testing/src/Mtest.py.in   Mon Oct 25 15:44:45 2010 +0200
+++ b/testing/src/Mtest.py.in   Mon Oct 25 17:28:28 2010 +0200
@@ -2164,15 +2164,18 @@
 ### Prompt(cmd) #
 
 def killProc(proc, outfile = None, cmd = None):
+    if outfile is not None and cmd is not None:
+        try:
+            outfile.write('\n!Mtimeout: Timeout: %s\n' % cmd)
+        except ValueError:
+            print 'cannot write timeout message',cmd
+    proc.killed = True
     try:
         os.kill(-proc.pid, signal.SIGKILL)
     except AttributeError:
         subprocess.Popen(['taskkill','/F','/T','/PID',str(proc.pid)])
     except OSError:
         pass
-    if outfile is not None and cmd is not None:
-        outfile.write('\n!Mtimeout: Timeout: %s\n' % cmd)
-    proc.killed = True
 
 def LaunchIt(cmd, TestInput, TestOut, TestErr, TimeOut, SrvrOut = None) :
     if not SrvrOut:
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to