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

SIGUSR1 handler only restarts notion if it returns to the mainloop #171

Open
wilhelmy opened this issue Aug 7, 2019 · 6 comments
Open

Comments

@wilhelmy
Copy link
Collaborator

wilhelmy commented Aug 7, 2019

I've been bitten by this twice so far, quitting the ibus tray icon makes notion hang. Notion offers a feature to restart itself if it is killed with SIGUSR1, but the signal handler only sets a global flag that SIGUSR1 has been received, and notion keeps being stuck further down the call stack without ever returning to the main loop.

I think we should add another signal for emergency restarts when the mainloop is unresponsive.

@wilhelmy
Copy link
Collaborator Author

wilhelmy commented Aug 7, 2019

I propose SIGSTKFLT ("stack fault on coprocessor (unused)" according to signal(7)) since indeed the stack is at fault.

@raboof
Copy link
Owner

raboof commented Aug 8, 2019

Interesting. We could also use SIGHUP for the 'graceful restart' and SIGUSR1 for 'emergency restart'?

@wilhelmy
Copy link
Collaborator Author

wilhelmy commented Aug 8, 2019

I'm not sure about SIGHUP since it's used at least by ssh to terminate the running program, so it might also be used as such by some session managers? I don't know, though.

SIGUSR2 is already in use for something else, apparently. I guess we should add a SIGNALS section to the manpage, too.

@raboof
Copy link
Owner

raboof commented Aug 8, 2019

I'm not sure about SIGHUP since it's used at least by ssh to terminate the running program

Not too uncommon to have it mean 'reload config' (https://en.wikipedia.org/wiki/Signal_(IPC)#SIGHUP), though indeed 'restart' is a bit different.

I guess we should add a SIGNALS section to the manpage, too.

Yes!

@wilhelmy
Copy link
Collaborator Author

wilhelmy commented Aug 8, 2019

Not too uncommon to have it mean 'reload config' (https://en.wikipedia.org/wiki/Signal_(IPC)#SIGHUP), though indeed 'restart' is a bit different.

As far as I know only for daemons which are not normally bound to a session, although it's a bit unclear.

@wilhelmy
Copy link
Collaborator Author

wilhelmy commented Aug 8, 2019

We might also be able to use SIGRTMIN..SIGRTMAX but I don't know how portable those are.
Edit: Seems they are part of POSIX.1-2001 and reserved for application specific use.
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html

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

No branches or pull requests

2 participants