Skip to content

Commit

Permalink
Wait for killed processes.
Browse files Browse the repository at this point in the history
If we don't wait for the process to exit and read its exit code, the
process will become a zombie once we exit.  These can be cleaned up by
the OS, but it is better to read the exit code to avoid it becoming a
zombie.

Issue #20

Change-Id: I6b978eb76929f7dca203d5dd9cec7d5dc08be8df
  • Loading branch information
TheModMaker committed Oct 2, 2019
1 parent 33da4c7 commit 35dac3e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions streamer/node_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def stop(self):
"""Stop the subprocess if it's still running."""
if self._process:
# Slightly more polite than kill. Try this first.

self._process.terminate()

if self.is_running():
Expand All @@ -73,4 +72,7 @@ def stop(self):
if self.is_running():
# If it's still not dead, use kill.
self._process.kill()
# Don't wait to see the results. If this didn't work, nothing will.
# Wait for the process to die and read its exit code. There is no way
# to ignore a kill signal, so this will happen quickly. If we don't do
# this, it can create a zombie process.
self._process.wait()

0 comments on commit 35dac3e

Please sign in to comment.