Skip to content

Commit

Permalink
code: wait 30s for clean exit, chg warn to debug, upversion
Browse files Browse the repository at this point in the history
  • Loading branch information
choppsv1 committed Feb 17, 2023
1 parent c8c92b1 commit 5ea5ff8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
6 changes: 3 additions & 3 deletions munet/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ async def cleanup_pid(self, pid, kill_pid=None):
if kill_pid is None:
kill_pid = pid

for sn in (signal.SIGTERM, signal.SIGKILL):
for sn in (signal.SIGHUP, signal.SIGKILL):
self.logger.debug(
"%s: %s %s (wait %s)", self, signal.Signals(sn).name, kill_pid, pid
)
Expand All @@ -420,15 +420,15 @@ async def cleanup_pid(self, pid, kill_pid=None):
return

# try each signal, waiting 15 seconds for exit before advancing
wait_sec = 20
wait_sec = 30
self.logger.debug("%s: waiting %ss for pid to exit", self, wait_sec)
for _ in Timeout(wait_sec):
try:
status = os.waitpid(pid, os.WNOHANG)
if status == (0, 0):
await asyncio.sleep(0.1)
else:
self.logger.info("pid %s exited status %s", pid, status)
self.logger.debug("pid %s exited status %s", pid, status)
return
except OSError as error:
if error.errno == errno.ECHILD:
Expand Down
4 changes: 1 addition & 3 deletions munet/native.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,7 @@ async def get_proc_child_pid(self, p):
spid = str(p.pid)
for _ in Timeout(4):
if p.returncode is not None:
self.logger.warning(
"%s: exit before getting child of proc: %s", self, p
)
self.logger.debug("%s: proc %s exited before getting child", self, p)
return None

rc, o, e = await commander.async_cmd_status(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "munet"
version = "0.12.8"
version = "0.12.9"
description = "A package to facilitate network simulations"
authors = ["Christian Hopps <[email protected]>"]
license = "GPL-2.0-or-later"
Expand Down

0 comments on commit 5ea5ff8

Please sign in to comment.