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

fix: Terminate trigger handler on spin up termination #642

Merged
merged 1 commit into from
Jul 14, 2022

Conversation

lann
Copy link
Collaborator

@lann lann commented Jul 14, 2022

The Ctrl-C handler works because it is handled in the trigger handler
child process, but if the parent spin up process is terminated
instead - as with e.g. Nomad - the child is left running.

Fix this by adding a signal handler to the parent process which sends
SIGTERM to the child.

I expect this to fix #638

@lann lann requested a review from adamreese July 14, 2022 18:03
The `Ctrl-C` handler works because it is handled in the trigger handler
child process, but if the parent `spin up` process is terminated
instead - as with e.g. Nomad - the child is left running.

Fix this by adding a signal handler to the parent process which sends
SIGTERM to the child.

Signed-off-by: Lann Martin <lann.martin@fermyon.com>
let status = cmd.status().context("Failed to execute trigger")?;
let mut child = cmd.spawn().context("Failed to execute trigger")?;

#[cfg(not(windows))]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if it is on Windows?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens on windows today? 🤷

@lann lann merged commit d1126cc into fermyon:main Jul 14, 2022
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.

Integration tests for go sdk does not terminate the spin process
3 participants