Bug 1274584 - [mozprocess] Fix IO Completion Port failed to signal process shutdown, r=jgriffin

Sometimes the IO completion port doesn't shutdown child processes. When this happens,
mozprocess will attempt to force kill the child processes manually. However, there is
a bug here which causes the OSError to get raised.

Although this fixes that bug, the original issue(s) which prevented the IOC port
from signaling shutdown remain and are still undiagnosed.

MozReview-Commit-ID: L3DQPW0Is5v

--HG--
extra : rebase_source : cf6320cffea5a4c8fb5d62861c41065d9dcefa52
This commit is contained in:
Andrew Halberstadt 2016-05-30 11:02:13 -04:00
Родитель 7746cfd17f
Коммит 95882ef0e4
1 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -395,12 +395,14 @@ falling back to not using job objects for managing child processes"""
# don't want to mistake that situation for the situation of an unexpected
# parent abort (which is what we're looking for here).
if diff.seconds > self.MAX_IOCOMPLETION_PORT_NOTIFICATION_DELAY:
print >> sys.stderr, "WARNING | IO Completion Port failed to signal process shutdown"
print >> sys.stderr, "Parent process %s exited with children alive:" % self.pid
print >> sys.stderr, "PIDS: %s" % ', '.join([str(i) for i in self._spawned_procs])
print >> sys.stderr, "Attempting to kill them..."
print >> sys.stderr, "Attempting to kill them, but no guarantee of success"
self.kill()
self._process_events.put({self.pid: 'FINISHED'})
break
if not portstatus:
# Check to see what happened
@ -472,7 +474,7 @@ falling back to not using job objects for managing child processes"""
threadalive = False
if hasattr(self, "_procmgrthread"):
threadalive = self._procmgrthread.is_alive()
if self._job and threadalive:
if self._job and threadalive and threading.current_thread() != self._procmgrthread:
self.debug("waiting with IO completion port")
# Then we are managing with IO Completion Ports
# wait on a signal so we know when we have seen the last