Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Cancelation of process with Context and Timeout/Deadline on GH Runner only kills the parent #49

Open
locnnil opened this issue Feb 20, 2024 · 1 comment
Labels
bug Something isn't working CI Continuous Integration

Comments

@locnnil
Copy link
Contributor

locnnil commented Feb 20, 2024

If a process is expected to be killed after a timeout with utils.ExecContext or utils.ExecContextVerbose when running inside a GH runner it's only killed the parent process and not the child ones.

@locnnil locnnil changed the title Cancelation of process with Context and Timeout on GH Runner only kills the parent Cancelation of process with Context and Timeout/Deadline on GH Runner only kills the parent Feb 20, 2024
@locnnil locnnil added the bug Something isn't working label Feb 20, 2024
@farshidtz
Copy link
Member

The issue isn't related to just cancellation via context. Reaching the timeout or deadline triggers the cancellation, which in turn kills the process. The same behavior should be expected when using os.Process.Kill.

The affected functions are tested here:
https://github.com/canonical/matter-snap-testing/blob/c15a6cdfc5419f574ce928f0ab1d29bab4cd37fd/utils/exec_test.go#L54-L65

and a recent run show that the timeout results in killing the process after 1 second:

=== RUN   TestExec/context_timed_out
2024/02/20 16:06:41 [exec] sleep 3
...
--- PASS: TestExec (2.11s)
    ...
    --- PASS: TestExec/context_timed_out (1.00s)
    ...
PASS
ok  	github.com/canonical/matter-snap-testing/utils	2.118s

@farshidtz farshidtz transferred this issue from canonical/matter-snap-testing Feb 20, 2024
@farshidtz farshidtz added the CI Continuous Integration label Feb 20, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working CI Continuous Integration
Projects
None yet
Development

No branches or pull requests

2 participants