You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The runner executes user commands which is ["/bin/bash", "i", "-c", ...commands joined by &&]. On stopping, it sends SIGINT. If the command fails to derminate in ex.killDelay (10s), then the runner sends SIGKILL:
cmd := exec.CommandContext(ctx, ex.jobSpec.Commands[0], ex.jobSpec.Commands[1:]...)
cmd.Cancel = func() error {
// returns error on Windows
return gerrors.Wrap(cmd.Process.Signal(os.Interrupt))
}
cmd.WaitDelay = ex.killDelay // kills the process if it doesn't exit in time
The problem is caused by how bash (other shells as well) handles signals in interactive mode. It does not propagates SIGINT nor exits:
SIGNALS
When bash is interactive, in the absence of any traps, it ignores SIGTERM (so that kill 0 does not kill an interactive
shell), and SIGINT is caught and handled (so that the wait builtin is interruptible). In all cases, bash ignores SIGQUIT.
If job control is in effect, bash ignores SIGTTIN, SIGTTOU, and SIGTSTP.
Sending SIGTERM is not an option as well since it's ignored completely.
Possible solutions:
Send SIGHUP. It makes the shell exist. And "Before exiting, an interactive shell resends the SIGHUP to all jobs, running or stopped." The problem with this is that daemon processes often ignore SIGHUP (e.g. anything shielded by nohup).
Trap signals (e.g. SIGTERM) and terminate all jobs in the interactive shell and the shell itself.
Expected behaviour
No response
dstack version
master
Server logs
Additional information
No response
The text was updated successfully, but these errors were encountered:
Steps to reproduce
There is also this runner log message:
Actual behaviour
The runner executes user commands which is
["/bin/bash", "i", "-c", ...commands joined by &&]
. On stopping, it sends SIGINT. If the command fails to derminate inex.killDelay
(10s), then the runner sends SIGKILL:The problem is caused by how bash (other shells as well) handles signals in interactive mode. It does not propagates SIGINT nor exits:
Sending SIGTERM is not an option as well since it's ignored completely.
Possible solutions:
Expected behaviour
No response
dstack version
master
Server logs
Additional information
No response
The text was updated successfully, but these errors were encountered: