Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always install default signal handler for SIGINT. #1413

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rayburgemeestre
Copy link

Reason for this fix is that in my case I created a systemd unit file for CentOS7.

Issuing systemctl stop digits makes it send SIGTERM to the Python process, but there is no handler for this. In packaging/deb/templates/digits.service I see there is a "hack" for Debian (make systemd use SIGINT instead of SIGTERM), but that doesn't seem to work on CentOS7. So what I did is create a bash script that traps SIGTERM from systemd and translates it into a SIGINT for Python.

Anyway in this case, the way Python is launched (as a subshell) it won't register the default handler for SIGINT. This is a small fix that simply always registers the SIGINT handler.. More info: http://stackoverflow.com/questions/40775054/capturing-sigint-using-keyboardinterrupt-exception-works-in-terminal-not-in-scr/40785230#40785230

I have another suggestion, maybe it's a better idea to additionally listen for SIGTERM?
If that is preferred I can update this PR with that solution?

This way the Python process running DIGITS can always be stopped with
SIGINT. (Python doesn't install this default handler in all cases.)
@lukeyeager
Copy link
Member

Interesting link. I'll have to think through the implications.

If the scheduler is running, SIGTERM will shut it down. Have you seen this line?
https://github.com/NVIDIA/DIGITS/blob/v5.0.0/digits/scheduler.py#L358

@rayburgemeestre
Copy link
Author

rayburgemeestre commented Jan 24, 2017

Actually I didn't see that! So scratch my suggestion to additionally listen to SIGTERM :)

It's nice that SIGINT can be used for the server and SIGTERM for the jobs.

Edit: was a bit too hasty with writing a reply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants