Skip to content

Ensure signals are passed to commands (#3548)#3558

Merged
thisisnotashwin merged 1 commit intorelease/1.2.xfrom
luke/1.2.x-ensure-signals
Feb 6, 2024
Merged

Ensure signals are passed to commands (#3548)#3558
thisisnotashwin merged 1 commit intorelease/1.2.xfrom
luke/1.2.x-ensure-signals

Conversation

@thisisnotashwin
Copy link
Contributor

  • Ensure signals are passed to commands

Change /bin/sh -ec "<command>" to
/bin/sh -ec "exec <command>". Adding exec ensures that <command> is not executed as a child process but replaces the /bin/sh process. This ensure that <command> receives any signals.

Specifically this is an issue when attempting to trap SIGTERMs as part of graceful pod shutdown. Without this change, we weren't receiving any signals because they aren't passed down by /bin/sh -c.

  • Fix broken bats tests and add changelog

Changes proposed in this PR

How I've tested this PR

How I expect reviewers to test this PR

Checklist

* Ensure signals are passed to commands

Change `/bin/sh -ec "<command>"` to
`/bin/sh -ec "exec <command>"`. Adding `exec` ensures that `<command>`
is not executed as a child process but replaces the `/bin/sh` process.
This ensure that `<command>` receives any signals.

Specifically this is an issue when attempting to trap SIGTERMs as part
of graceful pod shutdown. Without this change, we weren't receiving any
signals because they aren't passed down by `/bin/sh -c`.

* Fix broken bats tests and add changelog

Signed-off-by: Ashwin Venkatesh <ashwin.what@gmail.com>

---------

Signed-off-by: Ashwin Venkatesh <ashwin.what@gmail.com>
Co-authored-by: Ashwin Venkatesh <ashwin.what@gmail.com>
@thisisnotashwin thisisnotashwin added the pr/no-backport signals that a PR will not contain a backport label label Feb 6, 2024
@thisisnotashwin
Copy link
Contributor Author

Closes #3554

@thisisnotashwin thisisnotashwin merged commit f053e43 into release/1.2.x Feb 6, 2024
@thisisnotashwin thisisnotashwin deleted the luke/1.2.x-ensure-signals branch February 6, 2024 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr/no-backport signals that a PR will not contain a backport label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants