-
Notifications
You must be signed in to change notification settings - Fork 289
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
Use process group signal handling to reach past the shell #1126
base: master
Are you sure you want to change the base?
Conversation
Spawn processes is their own process group and then signal the process group intstead of just the process we spawned to ensure the signals also reach any subprocesses started by the process we spawned (which is always the case as we are wrapping all our processes spawning with "/bin/sh -c ..."). This make sending SIGINT work again, so revert back to that instead of SIGKILL. The reason SIGINT wasn't working was the shell logic is that this is expected to be sent to the process group, so it doesn't need to pass it along or anything. See the bash signals documentation page for more details https://www.gnu.org/software/bash/manual/html_node/Signals.html
@twhitehead thanks for your contribution! Can you please also write which is the problem that was solved in this way? I wrote the code originally but I do not remember problems with SIGKILL. Actually, the inline doc says that:
Is there a reason why SIGINT is better? Then a related note. There is a functionality that is currently off by default, namely the Thanks |
Hi @twhitehead
In this way every subprocess spawned by the child gets the same signal. Is that right? |
@Iximiel that is exactly correct. The issue with the way it currently is is only the |
@GiovanniBussi I don't actually know if
The main thing about |
To be clear, I don't actually use PLUMMED myself. Rather I am a technical person who supports Canadian researchers wanting to running various application on the Canadian super computers. This patch came out of looking into issues a Canadian research was having running the prior version of PLUMMED as a LAMMPS plugin on one of our clusters. |
Spawn processes is their own process group and then signal the process group intstead of just the process we spawned to ensure the signals also reach any subprocesses started by the process we spawned (which is always the case as we are wrapping all our processes spawning with "/bin/sh -c ...").
This make sending SIGINT work again, so revert back to that instead of SIGKILL. The reason SIGINT wasn't working was the shell logic is that this is expected to be sent to the process group, so it doesn't need to pass it along or anything. See the bash signals documentation page for more details
https://www.gnu.org/software/bash/manual/html_node/Signals.html
Description
Target release
It doesn't matter to me.
Type of contribution
Copyright
I agree to transfer the copyright of the code I have written to the PLUMED developers or to the author of the code I am modifying.
the module I added or modified contains a
COPYRIGHT
file with the correct license information. Code should be released under an open source license. I also used the commandcd src && ./header.sh mymodulename
in order to make sure the headers of the module are correct.Tests