Skip to content

Commit 22092fa

Browse files
committed
kill process group when killing kernel
if killpg is available this should cleanup process trees (e.g. multiprocessing subprocesses) and make EADDRINUSE less likely during restart.
1 parent 16d8122 commit 22092fa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

jupyter_client/manager.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,10 @@ def _kill_kernel(self):
372372
# Signal the kernel to terminate (sends SIGKILL on Unix and calls
373373
# TerminateProcess() on Win32).
374374
try:
375-
self.kernel.kill()
375+
if hasattr(signal, 'SIGKILL'):
376+
self.signal_kernel(signal.SIGKILL)
377+
else:
378+
self.kernel.kill()
376379
except OSError as e:
377380
# In Windows, we will get an Access Denied error if the process
378381
# has already terminated. Ignore it.

0 commit comments

Comments
 (0)