ipykernel icon indicating copy to clipboard operation
ipykernel copied to clipboard

ipykernel ignore signals

Open Roffild opened this issue 3 years ago • 1 comments

Runned as server in Docker:

$ kill -QUIT 1
$ kill -TERM 1
$ kill -KILL 1
$ ps
PID   USER     TIME  COMMAND
    1 usr       0:01 /usr/local/bin/python -m ipykernel --config=./ipykernel_conf.py

in docker-compose.yml:

services:
  ipykernel:
    command: ["/usr/local/bin/python", "-m", "ipykernel", "--config=./ipykernel_conf.py"]
    stop_signal: "SIGQUIT"
    stop_grace_period: "10s"

In my other script, I register a signal to break the loop. But I did not find this code in ipykernel.

import signal
import time

ISRUN = True

def sighandler(signum, frame):
    global ISRUN
    ISRUN = False
signal.signal(signal.SIGTERM, sighandler)
signal.signal(signal.SIGQUIT, sighandler)

while ISRUN:
    time.sleep(1)

Roffild avatar Jun 03 '22 13:06 Roffild

After quick search - https://github.com/ipython/ipykernel/blob/f03856014d5fdf86779a72b8d7f85f412f446696/ipykernel/kernelbase.py#L1245. Looks like IPykernel check kill signal for child processes, not main one.

darcsoel avatar Jun 29 '22 19:06 darcsoel