Bug 1272782 - Don't wait forever for child process to exit; r=ahal

I believe this is the source of hangs/timeouts in automation.
join() waits forever. We add code to wait at most N seconds before
force terminating the process. The timeout is a bit high. But it is
better than infinite.

MozReview-Commit-ID: KwyO4RZ9OqL

--HG--
extra : rebase_source : 767d8ff5b48d7e75ab8fe72b18145446a38d439a
This commit is contained in:
Gregory Szorc 2016-05-13 14:10:39 -07:00
Родитель 49e64768b0
Коммит e16f5d1baa
1 изменённых файлов: 11 добавлений и 2 удалений

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

@ -312,7 +312,16 @@ class SystemResourceMonitor(object):
self.measurements.append(SystemResourceUsage(start_time, end_time,
cpu_times, cpu_percent, io, virt, swap))
self._process.join()
# We establish a timeout so we don't hang forever if the child
# process has crashed.
self._process.join(10)
if self._process.is_alive():
self._process.terminate()
self._process.join(10)
else:
# We should have received a "done" message from the
# child indicating it shut down properly. This only
# happens if the child shuts down cleanly.
assert done
if len(self.measurements):