[Buildbot-commits] [Buildbot] #1749: xp slave fails to kill child process after network disconnect

Buildbot nobody at buildbot.net
Sat Jan 22 03:23:00 UTC 2011


#1749: xp slave fails to kill child process after network disconnect
----------------------+--------------------
Reporter:  philippem  |       Owner:
    Type:  defect     |      Status:  new
Priority:  critical   |   Milestone:  0.8.+
 Version:  0.8.3      |  Resolution:
Keywords:  windows    |
----------------------+--------------------

Comment (by philippem):

 I dug into this by launching a single ShellCommand that sleeps, the
 forcibly terminating it, with some logging in the Twisted
 _dumbwin32proc.py.

 I observed:

 - a cmd.exe process is used to launch the slave command.
 - the win32process.TerminateCommand is working, but it's only killing the
 cmd, not its "children".
 - on windows, you have to explicitly walk the process tree (while it still
 exists), and terminate processes whose parent is the one you want to kill,
 to do the equivalent of a linux kill process group.
 - usePTY is disabled, and probably irrelevant, on win32. I tried to set
 it to true, but the stdio of the step said:
 WARNING: disabling usePTY for this commandc:\long-running.pl

 - I used os.system("TASKKILL /PID %s /T /F" % self.pid), and this seemed
 to work, to kill the process and its parents. I did this in twisted -- not
 sure if this is an appropriate fix, or where you would want to put it.

 a diff of my _dumbwin32proc.py: (i'm using buildbot 0.8.2 on this xp
 slave):
 {{{
 c:\Python27\Lib\site-packages\twisted\internet>c:/unxutils/diff -c
 _dumbwin32proc.py _dumbwin32proc.py~
 c:/unxutils/diff -c _dumbwin32proc.py _dumbwin32proc.py~
 *** _dumbwin32proc.py   Fri Jan 21 19:09:44 2011
 --- _dumbwin32proc.py~  Mon Nov 29 14:26:40 2010
 ***************
 *** 172,180 ****
           def doCreate():
               self.hProcess, self.hThread, self.pid, dwTid =
 win32process.CreateProcess(
                   command, cmdline, None, None, 1, 0, env, path,
 StartupInfo)
 -             print "create:command=%s cmdline=%s env=%s path=%s
 StartupInfo=%s)" % (command, cmdline, env, path, StartupInfo)
 -             print "create: hProcess=%s hThread=%s pid=%s dwTid=%s" %
 (self.hProcess, self.hThread, self.pid, dwTid)
 -
           try:
               doCreate()
           except pywintypes.error, pwte:
 --- 172,177 ----
 ***************
 *** 241,250 ****
           if self.pid is None:
               raise error.ProcessExitedAlready()
           if signalID in ("INT", "TERM", "KILL"):
 !             print "terminate process on hProcess: hProcess=%s pid = %s"
 % (self.hProcess, self.pid)
 !             os.system("TASKKILL /PID %s /T /F" % self.pid)
 ! #            win32process.TerminateProcess(self.hProcess, 1)
 !


       def _getReason(self, status):
 --- 238,244 ----
           if self.pid is None:
               raise error.ProcessExitedAlready()
           if signalID in ("INT", "TERM", "KILL"):
 !             win32process.TerminateProcess(self.hProcess, 1)


       def _getReason(self, status):

 c:\Python27\Lib\site-packages\twisted\internet>
 }}}

-- 
Ticket URL: <http://trac.buildbot.net/ticket/1749#comment:12>
Buildbot <http://buildbot.net/>
Buildbot: build/test automation


More information about the Commits mailing list