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

ToolRunner.killChildProcess() unexpectedly sends SIGTERM instead of SIGINT #858

Open
DaRosenberg opened this issue Aug 13, 2022 · 15 comments · May be fixed by #859
Open

ToolRunner.killChildProcess() unexpectedly sends SIGTERM instead of SIGINT #858

DaRosenberg opened this issue Aug 13, 2022 · 15 comments · May be fixed by #859

Comments

@DaRosenberg
Copy link

DaRosenberg commented Aug 13, 2022

Environment

azure-pipelines-task-lib version: 3.3.1

Issue Description

The method ToolRunner.killChildProcess() is documented as follows:

/**
 * Used to close child process by sending SIGNINT signal.
 * It allows executed script to have some additional logic on SIGINT, before exiting.
 */

However, its implementation forwards without arguments to Node's ChildProcess.kill() method (documented here) which by default sends SIGTERM to the child process unless a specific signal is specified.

This leads to unexpected behavior for scripts in downstream BashV3 pipeline task, where script tasks will receive SIGTERM instead of SIGINT.

The bug was introduced with #663 the intent of which was to add functionality for killing child processes.

Fixing a related incorrect behavior in BashV3 requires changes both here and in the downstream azure-pipelines-tasks library so I will create issues (and PRs) in both repos and update in both places to cross-reference.

Expected behaviour

The ToolRunner.killChildProcess() method should have a parameter allowing caller to specify which signal should be sent to the child process. If undefined, the method should default to SIGINT as per its docs and to ensure this is a non-breaking change.

Actual behaviour

The ToolRunner.killChildProcess() method implicitly sends SIGTERM to child process.

@DaRosenberg
Copy link
Author

On second thought it's probably better to have this API mirror that of Node and have the same default, and leave it up to the caller to specify something else if desired.

DaRosenberg pushed a commit to DaRosenberg/azure-pipelines-task-lib that referenced this issue Aug 14, 2022
@max-zaytsev
Copy link
Contributor

Hi @DaRosenberg, thank you for creating an issue. We're currently working on the more prioritized tickets. We'll take a look at it once we have enough capacity.

@github-actions
Copy link

This issue has had no activity in 90 days. Please comment if it is not actually stale

@github-actions github-actions bot added the stale label Dec 20, 2022
@DaRosenberg
Copy link
Author

Issue is alive and well.

@github-actions github-actions bot removed the stale label Dec 20, 2022
@github-actions
Copy link

This issue has had no activity in 90 days. Please comment if it is not actually stale

@github-actions github-actions bot added the stale label Mar 20, 2023
@DaRosenberg
Copy link
Author

Issue is still alive and well.

@github-actions github-actions bot removed the stale label Mar 21, 2023
@github-actions
Copy link

This issue has had no activity in 90 days. Please comment if it is not actually stale

@github-actions github-actions bot added the stale label Jun 19, 2023
@DaRosenberg
Copy link
Author

Issue is alive and well.

@github-actions github-actions bot removed the stale label Jun 19, 2023
@github-actions
Copy link

This issue has had no activity in 90 days. Please comment if it is not actually stale

@github-actions github-actions bot added the stale label Sep 17, 2023
@DaRosenberg
Copy link
Author

Issue is alive and well.

@github-actions github-actions bot removed the stale label Sep 17, 2023
Copy link

This issue has had no activity in 90 days. Please comment if it is not actually stale

@github-actions github-actions bot added the stale label Dec 16, 2023
@mouellet
Copy link

not stale

@github-actions github-actions bot removed the stale label Dec 17, 2023
Copy link

This issue has had no activity in 90 days. Please comment if it is not actually stale

@github-actions github-actions bot added the stale label Mar 16, 2024
@DaRosenberg
Copy link
Author

Not stale, and PR remains available with an easy fix.

@github-actions github-actions bot removed the stale label Mar 18, 2024
@pszypowicz
Copy link

Please someone review and approve this #859, without it tasks are not able to receive sigint properly. We are running terraform in bash task, and we only receive sigterm (with a proper bash trap), so terraform is not given enough time to gracefully shutdown and safe tfstate file.

Again @DaRosenberg change is NOT breaking. It is fully backward compatible, which is great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants