Skip to content

[JENKINS-75879] GStringTemplateEngine causes memory leak in class loading#10938

Merged
basil merged 3 commits intojenkinsci:masterfrom
jgarciacloudbees:JENKINS-75879
Aug 14, 2025
Merged

[JENKINS-75879] GStringTemplateEngine causes memory leak in class loading#10938
basil merged 3 commits intojenkinsci:masterfrom
jgarciacloudbees:JENKINS-75879

Conversation

@jgarciacloudbees
Copy link
Contributor

@jgarciacloudbees jgarciacloudbees commented Aug 8, 2025

See JENKINS-75879.

Testing done

Manual testing performed related to the current case of use described on JENKINS-75879.

  • The system works properly and the pipeline is executed with no issues.
  • Comparing the heap dump from before and after the changes we can see:
    • In the previous version there were a lot of ParallelLocks for the classess jenkins.util.URLClassLoader2 related to objects similar to: groovy.tmp.templates.GStringTemplateScript*
    • In the new version, such ParallelLocks are not created.

Proposed changelog entries

  • Fix memory leak in Java class loading for the GStringTemplateEngine class.

Proposed changelog category

/label bug

Proposed upgrade guidelines

N/A

Submitter checklist

  • The Jira issue, if it exists, is well-described.
  • The changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developers, depending on the change) and are in the imperative mood (see examples). Fill in the Proposed upgrade guidelines section only if there are breaking changes or changes that may require extra steps from users during upgrade.
  • There is automated testing or an explanation as to why this change has no tests.
  • [] New public classes, fields, and methods are annotated with @Restricted or have @since TODO Javadocs, as appropriate.-> N/A, no new items created
  • New deprecations are annotated with @Deprecated(since = "TODO") or @Deprecated(forRemoval = true, since = "TODO"), if applicable.-> N/A, no deprecated elements
  • New or substantially changed JavaScript is not defined inline and does not call eval to ease future introduction of Content Security Policy (CSP) directives (see documentation). -> N/A, no javascript changes
  • For dependency updates, there are links to external changelogs and, if possible, full differentials. -> N/A no dependency updates
  • For new APIs and extension points, there is a link to at least one consumer. -> N/A no new APIs or extension points

Desired reviewers

@jglick, @Dohbedoh

Before the changes are marked as ready-for-merge:

Maintainer checklist

  • There are at least two (2) approvals for the pull request and no outstanding requests for change.
  • Conversations in the pull request are over, or it is explicit that a reviewer is not blocking the change.
  • Changelog entries in the pull request title and/or Proposed changelog entries are accurate, human-readable, and in the imperative mood.
  • Proper changelog labels are set so that the changelog can be generated automatically.
  • If the change needs additional upgrade steps from users, the upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the pull request title (see example).
  • If it would make sense to backport the change to LTS, a Jira issue must exist, be a Bug or Improvement, and be labeled as lts-candidate to be considered (see query).

@welcome
Copy link

welcome bot commented Aug 8, 2025

Yay, your first pull request towards Jenkins core was created successfully! Thank you so much!

A contributor will provide feedback soon. Meanwhile, you can join the chats and community forums to connect with other Jenkins users, developers, and maintainers.

@comment-ops-bot comment-ops-bot bot added the bug For changelog: Minor bug. Will be listed after features label Aug 8, 2025
@dukhlov
Copy link
Contributor

dukhlov commented Aug 8, 2025

Covered by https://github.com/jenkinsci/jenkins/pull/10659/files#diff-0dd3c7930da03922fff631a2cf06fbfda9b9bc688a4e5804fceda225147778a6L2412

Copy link

@A1exKH A1exKH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@Dohbedoh
Copy link
Contributor

LGTM.
I am wondering if we want to also ignore classes from other String template implementation such as StreamingTemplateScript* and XmlTemplateScript* ?

Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/label ready-for-merge


This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.

Thanks!

@comment-ops-bot comment-ops-bot bot added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Aug 13, 2025
@basil basil merged commit ef42f3c into jenkinsci:master Aug 14, 2025
4 of 9 checks passed
@welcome
Copy link

welcome bot commented Aug 14, 2025

Congratulations on getting your very first Jenkins core pull request merged 🎉🥳

This is a fantastic achievement, and we're thrilled to have you as part of our community! Thank you for your valuable input, and we look forward to seeing more of your contributions in the future!

We would like to invite you to join the community chats and forums to meet other Jenkins contributors 😊
Don't forget to check out the participation page to learn more about how to contribute to Jenkins.


@basil basil changed the title [JENKINS-75879] - GStringTemplateEngine causes memory leak in ClassLoading [JENKINS-75879] GStringTemplateEngine causes memory leak in class loading Aug 14, 2025
@jgarciacloudbees jgarciacloudbees deleted the JENKINS-75879 branch August 18, 2025 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug For changelog: Minor bug. Will be listed after features ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants