-
Bug
-
Resolution: Unresolved
-
Blocker
-
None
-
Jenkins version: Jenkins 2.509
amazon-ecr:1.151.vb_ca_71ddd0b_cf
amazon-ecs:1.49
ansicolor:1.0.6
ant:513.vde9e7b_a_0da_0f
artifact-manager-s3:902.v39b_3d56b_88b_5
artifactory:4.0.8
audit-trail:395.vce180b_359a_b_5
authorize-project:2.0.0
aws-codebuild:0.59
aws-parameter-store:1.2.2
basic-branch-build-strategies:228.v68c089762a_db_
blueocean-jira:1.27.19
blueocean:1.27.19
build-discarder:158.vce570d01ce4c
build-failure-analyzer:2.5.5
build-timeout:1.38
build-token-root:151.va_e52fe3215fc
build-user-vars-plugin:195.v8c35f9d5c3dc
build-with-parameters:76.v9382db_f78962
checks-api:370.vb_61a_c57328f3
command-launcher:123.v37cfdc92ef67
compact-columns:1.199.v61a_f51712072
config-file-provider:988.v0461fcc2b_9d1
configuration-as-code:1967.va_968e15fd05b_
copyartifact:770.va_6c69e063442
disable-github-multibranch-status:1.2
docker-commons:451.vd12c371eeeb_3
docker-workflow:611.v16e84da_6d3ff
ec2-fleet:3.2.0
ec2:1911.vccb_5a_56f62e6
email-ext:1876.v28d8d38315b_d
external-monitor-job:223.vb_fddcf42c9b_3
generic-webhook-trigger:2.3.1
git-client:6.1.3
git-forensics:3.2.0
git:5.7.0
github-checks:602.v264a_83610da_6
github-pr-comment-build:134.ve7ff0b_719821
github:1.43.0
gradle:2.14.1
groovy:497.v7b_061a_a_de65d
hidden-parameter:414.vfe0a_8b_052546
http_request:1.20
inline-pipeline:1.0.3
instance-identity:203.v15e81a_1b_7a_38
javax-mail-api:1.6.2-11
jdk-tool:83.v417146707a_3d
jira:3.15
jmh-report:0.9.0
jnr-posix-api:3.1.20-138.vdb_9db_a_39182f
job-dsl:1.92
jobConfigHistory:1305.vf20a_356586b_8
ldap:780.vcb_33c9a_e4332
lockable-resources:1166.v7ef984f72fe2
mapdb-api:1.0.9-44.va_1e1310c9118
matrix-auth:3.2.6
maven-plugin:3.26
monitoring:2.5.0
multibranch-build-strategy-extension:61.vf6d8f6f5ed02
next-executions:424.v631378313e29
oidc-provider:111.v29fd614b_3617
pam-auth:1.12
Parameterized-Remote-Trigger:3.2.1
parameterized-scheduler:285.ve611986d4c48
pipeline-aws:1.45
pipeline-github:2.8-162.382498405fdc
pipeline-graph-view:514.vc1792344c64f
pipeline-model-definition:2.2255.v56a_15e805f12
pipeline-stage-view:2.38
pipeline-utility-steps:2.19.0
reverse-proxy-auth-plugin:238.v82ceca_8417a_6
role-strategy:756.v978cb_392eb_d3
saml:4.525.v4f6a_7209447e
scoverage:1.4.0
scriptler:363.vd97ef616cb_f9
show-build-parameters:1.0
simple-theme-plugin:211.v5424a_5510e47
slack:761.v2a_8770f0d169
snakeyaml-api:2.3-125.v4d77857a_b_402
snyk-security-scanner:4.1.0
ssh-agent:384.ve275343791a_6
sshd:3.353.v2b_d33c46e970
subversion:1287.vd2d507146906
sumologic-publisher:2.2.6
support-core:1725.va_2a_9f06eed61
throttle-concurrents:2.16
timestamper:1.28
trilead-api:2.209.v0e69b_c43c245
uno-choice:2.8.3
view-job-filters:399.v6c89d5e6ff54
warnings-ng:12.5.0
workflow-aggregator:608.v67378e9d3db_1
workflow-cps:4106.v7a_8a_8176d450
ws-cleanup:0.48
cat /etc/*release*
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
$ java --version
openjdk 21.0.7 2025-04-15 LTS
OpenJDK Runtime Environment Temurin-21.0.7+6 (build 21.0.7+6-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.7+6 (build 21.0.7+6-LTS, mixed mode)
Jenkins version: Jenkins 2.509 amazon-ecr:1.151.vb_ca_71ddd0b_cf amazon-ecs:1.49 ansicolor:1.0.6 ant:513.vde9e7b_a_0da_0f artifact-manager-s3:902.v39b_3d56b_88b_5 artifactory:4.0.8 audit-trail:395.vce180b_359a_b_5 authorize-project:2.0.0 aws-codebuild:0.59 aws-parameter-store:1.2.2 basic-branch-build-strategies:228.v68c089762a_db_ blueocean-jira:1.27.19 blueocean:1.27.19 build-discarder:158.vce570d01ce4c build-failure-analyzer:2.5.5 build-timeout:1.38 build-token-root:151.va_e52fe3215fc build-user-vars-plugin:195.v8c35f9d5c3dc build-with-parameters:76.v9382db_f78962 checks-api:370.vb_61a_c57328f3 command-launcher:123.v37cfdc92ef67 compact-columns:1.199.v61a_f51712072 config-file-provider:988.v0461fcc2b_9d1 configuration-as-code:1967.va_968e15fd05b_ copyartifact:770.va_6c69e063442 disable-github-multibranch-status:1.2 docker-commons:451.vd12c371eeeb_3 docker-workflow:611.v16e84da_6d3ff ec2-fleet:3.2.0 ec2:1911.vccb_5a_56f62e6 email-ext:1876.v28d8d38315b_d external-monitor-job:223.vb_fddcf42c9b_3 generic-webhook-trigger:2.3.1 git-client:6.1.3 git-forensics:3.2.0 git:5.7.0 github-checks:602.v264a_83610da_6 github-pr-comment-build:134.ve7ff0b_719821 github:1.43.0 gradle:2.14.1 groovy:497.v7b_061a_a_de65d hidden-parameter:414.vfe0a_8b_052546 http_request:1.20 inline-pipeline:1.0.3 instance-identity:203.v15e81a_1b_7a_38 javax-mail-api:1.6.2-11 jdk-tool:83.v417146707a_3d jira:3.15 jmh-report:0.9.0 jnr-posix-api:3.1.20-138.vdb_9db_a_39182f job-dsl:1.92 jobConfigHistory:1305.vf20a_356586b_8 ldap:780.vcb_33c9a_e4332 lockable-resources:1166.v7ef984f72fe2 mapdb-api:1.0.9-44.va_1e1310c9118 matrix-auth:3.2.6 maven-plugin:3.26 monitoring:2.5.0 multibranch-build-strategy-extension:61.vf6d8f6f5ed02 next-executions:424.v631378313e29 oidc-provider:111.v29fd614b_3617 pam-auth:1.12 Parameterized-Remote-Trigger:3.2.1 parameterized-scheduler:285.ve611986d4c48 pipeline-aws:1.45 pipeline-github:2.8-162.382498405fdc pipeline-graph-view:514.vc1792344c64f pipeline-model-definition:2.2255.v56a_15e805f12 pipeline-stage-view:2.38 pipeline-utility-steps:2.19.0 reverse-proxy-auth-plugin:238.v82ceca_8417a_6 role-strategy:756.v978cb_392eb_d3 saml:4.525.v4f6a_7209447e scoverage:1.4.0 scriptler:363.vd97ef616cb_f9 show-build-parameters:1.0 simple-theme-plugin:211.v5424a_5510e47 slack:761.v2a_8770f0d169 snakeyaml-api:2.3-125.v4d77857a_b_402 snyk-security-scanner:4.1.0 ssh-agent:384.ve275343791a_6 sshd:3.353.v2b_d33c46e970 subversion:1287.vd2d507146906 sumologic-publisher:2.2.6 support-core:1725.va_2a_9f06eed61 throttle-concurrents:2.16 timestamper:1.28 trilead-api:2.209.v0e69b_c43c245 uno-choice:2.8.3 view-job-filters:399.v6c89d5e6ff54 warnings-ng:12.5.0 workflow-aggregator:608.v67378e9d3db_1 workflow-cps:4106.v7a_8a_8176d450 ws-cleanup:0.48 cat /etc/*release* PRETTY_NAME="Debian GNU/Linux 12 (bookworm)" NAME="Debian GNU/Linux" VERSION_ID="12" VERSION="12 (bookworm)" VERSION_CODENAME=bookworm ID=debian HOME_URL=" https://www.debian.org/ " SUPPORT_URL=" https://www.debian.org/support " BUG_REPORT_URL=" https://bugs.debian.org/ " $ java --version openjdk 21.0.7 2025-04-15 LTS OpenJDK Runtime Environment Temurin-21.0.7+6 (build 21.0.7+6-LTS) OpenJDK 64-Bit Server VM Temurin-21.0.7+6 (build 21.0.7+6-LTS, mixed mode)
We've been observing frequent instances where Jenkins becomes unresponsive. During these occurrences, the Jenkins instance appears heavily hung, with a significant number of active threads.
The heap was initially configured with 16GB. As memory usage continued to grow, we increased it to 18GB and later to 20GB, but the issue still persisted.
We attempted to analyze the thread dumps to identify and terminate any problematic threads, but that didn't resolve the issue. Ultimately, the only reliable way to recover Jenkins has been to restart the instance.
However, a safeRestart does not help in this scenario. We consistently need to go to the AWS console, update the service, and trigger a new deployment to restore Jenkins functionality.
Took a heap dump and analyzed it through Eclipse MAT.
1. Overall Heap Breakdown * Total heap inspected: ~9.4 GB
2. Analyzed the below two suspects WorkflowRun objects (2.97GB) and CpsFlowExecution(2.30GB):
(a) WorkflowRun objects (~2.97 GB):
(b) CpsFlowExecution objects (~2.30 GB)
Started analyzing the source of these WorkflowRun objects and found that top contributors were different jobs from the affected jenkins.
Our current setup:
- Seed job / Job-DSL: defines a logRotator { ... }}} in every {{{}pipelineJob { ... }{}, which injects a <logRotator> into each job's config.xml.
- Declarative Pipelines: none of our Jenkinsfile pipelines include an {{options { buildDiscarder(...) }}} block.
While investigating the issue, we came across an understanding, though not explicitly stated in Jenkins documentation, that using buildDiscarder in a Declarative Pipeline can help mitigate JVM heap buildup by cleaning up old WorkflowRun and CPS VM state. This isn't directly documented, but it's a widely acknowledged behavior within the Jenkins community.
Are we correct in understanding that it's necessary to include buildDiscarder within a Declarative Pipeline?
Is configuring logRotator in the job DSL file and having simpleBuildDiscarder in Jenkins configuration, not sufficient to ensure cleanup of these potentially leaking objects?
If there are any additional suggestions or recommendations to help address this issue, we'd greatly appreciate your input.