Skip to content

Abort doesn't propagate SIGTERM to shell script #545

@Tommigun1980

Description

@Tommigun1980

Jenkins and plugins versions report

Environment
Jenkins: 2.553
OS: Mac OS X - 15.6.1
Java: 21.0.6 - Homebrew (OpenJDK 64-Bit Server VM)
---
analysis-model-api:13.21.0-941.va_912a_3314a_16
ant:520.vd082ecfb_16a_9
antisamy-markup-formatter:173.v680e3a_b_69ff3
apache-httpcomponents-client-4-api:4.5.14-269.vfa_2321039a_83
apache-httpcomponents-client-5-api:5.6-191.vb_47e2b_41c698
appcenter:0.11.1
asm-api:9.9.1-189.vb_5ef2964da_91
authentication-tokens:1.144.v5ff4a_5ec5c33
blueocean:1.27.25
blueocean-autofavorite:1.2.5
blueocean-bitbucket-pipeline:1.27.25
blueocean-commons:1.27.25
blueocean-config:1.27.25
blueocean-core-js:1.27.25
blueocean-dashboard:1.27.25
blueocean-display-url:2.4.4
blueocean-events:1.27.25
blueocean-git-pipeline:1.27.25
blueocean-github-pipeline:1.27.25
blueocean-i18n:1.27.25
blueocean-jwt:1.27.25
blueocean-personalization:1.27.25
blueocean-pipeline-api-impl:1.27.25
blueocean-pipeline-editor:1.27.25
blueocean-pipeline-scm-api:1.27.25
blueocean-rest:1.27.25
blueocean-rest-impl:1.27.25
blueocean-web:1.27.25
bootstrap5-api:5.3.8-895.v4d0d8e47fea_d
bouncycastle-api:2.30.1.83-289.v8426fcd19371
branch-api:2.1280.v0d4e5b_b_460ef
build-failure-analyzer:2.6.1
build-monitor-plugin:1.14-985.v7b_f37b_3d0b_f5
build-name-setter:2.5.1
build-timeout:1.40
caffeine-api:3.2.3-194.v31a_b_f7a_b_5a_81
cctray-xml:155.v5139a_4591a_3e
checks-api:402.vca_263b_f200e3
cloudbees-bitbucket-branch-source:937.2.5
cloudbees-folder:6.1079.vc0975c2de294
command-launcher:123.v37cfdc92ef67
commons-collections4-api:4.5.0-8.va_d5448ef9011
commons-compress-api:1.28.0-3
commons-lang3-api:3.20.0-109.ve43756e2d2b_4
commons-text-api:1.15.0-218.va_61573470393
copyartifact:795.ve8e151429b_27
credentials:1491.v6d6145e96e1c
credentials-binding:717.v951d49b_5f3a_a_
data-tables-api:2.3.7-1534.v539d4edf109d
display-url-api:2.217.va_6b_de84cc74b_
downstream-build-cache:1.7
durable-task:664.v2b_e7a_dfff66c
echarts-api:6.0.0-1165.vd1283a_3e37d4
eddsa-api:0.3.0.1-29.v67e9a_1c969b_b_
email-ext:1933.v45cec755423f
external-monitor-job:223.vb_fddcf42c9b_3
favorite:2.263.v941d21defef7
font-awesome-api:7.2.0-965.ve3840b_696418
forensics-api:3.1832.va_1179842528b_
git:5.10.0
git-client:6.5.0
github:1.46.0
github-api:1.330-492.v3941a_032db_2a_
github-branch-source:1967.vdea_d580c1a_b_a_
global-slack-notifier:1.5
gradle:2.18.1203.v2c96b_1243c72
gson-api:2.13.2-173.va_a_092315913c
handy-uri-templates-2-api:2.1.8-38.vcea_5d521d5f3
htmlpublisher:427
instance-identity:203.v15e81a_1b_7a_38
ionicons-api:94.vcc3065403257
jackson2-api:2.21.1-428.vf8dd988fa_d8d
jackson3-api:3.1.0-64.v37e742c35905
jakarta-activation-api:2.1.4-1
jakarta-mail-api:2.1.5-1
jakarta-xml-bind-api:4.0.6-12.vb_1833c1231d3
javax-activation-api:1.2.0-8
javax-mail-api:1.6.2-11
jaxb:2.3.9-143.v5979df3304e6
jdk-tool:83.v417146707a_3d
jenkins-design-language:1.27.25
jjwt-api:0.11.5-120.v0268cf544b_89
job-restrictions:216.v0732cc7fb_076
joda-time-api:2.14.1-187.vdf2def02b_8a_1
jquery3-api:3.7.1-619.vdb_10e002501a_
jsch:0.2.16-95.v3eecb_55fa_b_78
json-api:20251224-185.v0cc18490c62c
json-path-api:3.0.0-218.vcd4dd1355de2
jsoup:1.22.1-76.v9cdb_2456c0e3
junit:1402.va_87fd3d15dc3
ldap:807.v7d7de30930cf
log-parser:3.0.2
mailer:525.v2458b_d8a_1a_71
matrix-auth:3.2.9
matrix-project:870.v9db_fcfc2f45b_
metrics:4.2.37-494.v06f9a_939d33a_
mina-sshd-api-common:2.16.0-167.va_269f38cc024
mina-sshd-api-core:2.16.0-167.va_269f38cc024
multibranch-scan-webhook-trigger:1.0.11
nunit:617.vb_152b_0a_7d168
okhttp-api:5.3.2-200.vedb_720a_cf1f8
pam-auth:1.12
pipeline-build-step:584.vdb_a_2cc3a_d07a_
pipeline-github-lib:65.v203688e7727e
pipeline-graph-analysis:254.v0f63a_a_447dca_
pipeline-groovy-lib:787.ve2fef0efdca_6
pipeline-input-step:540.v14b_100d754dd
pipeline-milestone-step:138.v78ca_76831a_43
pipeline-model-api:2.2277.v00573e73ddf1
pipeline-model-definition:2.2277.v00573e73ddf1
pipeline-model-extensions:2.2277.v00573e73ddf1
pipeline-rest-api:2.39
pipeline-stage-step:322.vecffa_99f371c
pipeline-stage-tags-metadata:2.2277.v00573e73ddf1
pipeline-stage-view:2.39
pipeline-utility-steps:2.20.0
plain-credentials:199.v9f8e1f741799
plasticscm-plugin:4.4
plot:2.4.0
plugin-util-api:6.1192.v30fe6e2837ff
prism-api:1.30.0-703.v116fb_3b_5b_b_a_a_
pubsub-light:1.19
resource-disposer:0.25
role-strategy:848.va_a_ea_673cf0b_c
scm-api:728.vc30dcf7a_0df5
script-security:1399.ve6a_66547f6e1
slack:795.v4b_9705b_e6d47
snakeyaml-api:2.5-149.v72471e9c6371
snakeyaml-engine-api:3.0.1-5.vd98ea_ff3b_92e
sse-gateway:1.29
ssh-agent:386.v36cc0c7582f0
ssh-credentials:361.vb_f6760818e8c
ssh-slaves:3.1097.v868116049892
sshd:3.384.vc89b_5e138cf9
structs:362.va_b_695ef4fdf9
throttle-concurrents:625.vc8b_e469e9a_b_c
timestamper:1.30
token-macro:477.vd4f0dc3cb_cf1
trilead-api:2.284.v1974ea_324382
variant:70.va_d9f17f859e0
warnings-ng:12.10012.v753ff0d0363a_
workflow-aggregator:608.v67378e9d3db_1
workflow-api:1398.v67030756d3fb_
workflow-basic-steps:1098.v808b_fd7f8cf4
workflow-cps:4258.v55f7f1691526
workflow-durable-task-step:1464.v2d3f5c68f84c
workflow-job:1571.vb_423c255d6d9
workflow-multibranch:821.vc3b_4ea_780798
workflow-scm-step:466.va_d69e602552b_
workflow-step-api:710.v3e456cc85233
workflow-support:1015.v785e5a_b_b_8b_22
ws-cleanup:0.49
xcode-plugin:2.0.17-565.v1c48051d46ef
yet-another-build-visualizer:1.17
[REST API](http://XXX:8080/manage/api/)
Jenkins 2.553

What Operating System are you using (both controller, and any agents involved in the problem)?

macOS Sequoia 15.6.1

Reproduction steps

  1. Make a shellscript: Put a while true loop with sleep in the shell script + a SIGTERM trap. Print out something after every iteration.
  2. Make a declarative pipeline
  3. Call 'sh myshellscript.sh' in a pipeline step
  4. Abort the build

Expected Results

The shellscript's SIGTERM trap should trigger. The shellscript should terminate.

Actual Results

The shell script isn't aborted and any possible SIGTERM trap is not invoked. Furthermore, after aborting the shell script keeps printing from its while true loop, until Jenkins prints that 20 seconds have passed at which point it kills the shell script.

Anything else?

It seems like the TERM signal is never sent to the shell script when a build is aborted.

I also posted this issue here as it is unclear to me whether this belongs in durable-task-plugin or workflow-durable-task-step-plugin. Feel free to close if incorrectly filed.

Are you interested in contributing a fix?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions