-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
BashV3 task incorrectly sends SIGTERM to child process instead of SIGINT #16731
Comments
Hi @DaRosenberg! |
Note, this messes up docker deployments using bash shells, as it shuts down the container after exiting the shell. I had been banging my head against the wall for the past couple of days... |
@kirill-ivlev Thanks for the notice that you've seen this — however, this is really not a feature request but rather a bug report, and regarding capacity and your backlog, perhaps you did not notice that I have submitted the PRs to fix this issue? All you need to do is accept them. |
This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days |
This issue is still alive and well, so please remove stale label. Non-breaking PRs have been open in both repos for 6 months. All MS has to do is merge them. |
I've been impacted by this as well. Wondering if anyone has any workarounds. |
This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days |
This issue is still alive and well, so please remove stale label. Non-breaking PRs have been open in both repos for 12 months. All MS has to do is merge them. |
When running a bash task inside a Docker container I don't get any signals on timeout (
|
The necessary signal parameter has now finally been added in the upstream library: Which means this bug can now be fixed. |
@DaRosenberg, the PR with signal handling in BashV3 and CmdLineV2 tasks has been merged to the master. Now, we're waiting for the next tasks' release. |
@ivanduplenskikh Awesome - good things come to those who wait! ;) |
Required Information
Type: Bug
Task Name: BashV3
Environment
Server: Azure Pipelines
Agent: Hosted
Issue Description
BashV3
contains code to listen forSIGINT
from the agent and forward the signal to the child process (via theToolRunner.killChildProcess()
method). This logic was initially introduced in #13573.The implementation does not work as expected, for two reasons:
Because of ToolRunner.killChildProcess() unexpectedly sends SIGTERM instead of SIGINT azure-pipelines-task-lib#858 the POSIX signals get mixed up; the agent sends
SIGINT
to the task, but the task ends up sendingSIGTERM
to the child process.The task listens only for
SIGINT
but it should also listen forSIGTERM
because as stated here the agent apparently sends both, at different times to indicate different levels of urgency.A more correct implementation would be:
ToolRunner.killChildProcess()
to allow specifying the signal to sendSIGINT
and callbash.killChildProcess("SIGINT");
SIGTERM
and callbash.killChildProcess("SIGTERM");
Small changes are necessary in both libraries to address this, so I will create issues and PRs in both repos and update both with links to cross-reference.
Task logs
Here's a simple repro pipeline:
Running it will show the following:
As show in the screenshot, the script task receives
SIGTERM
and nothing else.The text was updated successfully, but these errors were encountered: