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

Fix memory leak issue in policy evaluation #2872

Merged

Conversation

Shawyeok
Copy link
Contributor

@Shawyeok Shawyeok commented Jul 5, 2023

Description

In org.dependencytrack.policy.AbstractPolicyEvaluator, there is a QueryManager created while instance initialization,

protected QueryManager qm = new QueryManager();
public void setQueryManager(final QueryManager qm) {
this.qm = qm;
}

and later overwrite by it's setter which is called in VulnerabilityAnalysisTask execution, therefor the older instance of QueryManager will never get closed, so it leads to a memory leak.

Addressed Issue

#2785 (comment)

Additional Details

Checklist

  • I have read and understand the contributing guidelines
  • This PR fixes a defect, and I have provided tests to verify that the fix is effective
  • This PR implements an enhancement, and I have provided tests to verify that it works as intended
  • This PR introduces changes to the database model, and I have added corresponding update logic
  • This PR introduces new or alters existing behavior, and I have updated the documentation accordingly

@Shawyeok Shawyeok force-pushed the hotfix/fix-memory-leak-query-manager branch 2 times, most recently from 6457b3e to c8148ca Compare July 5, 2023 13:21
Signed-off-by: shawyeok <kmter@live.com>
Copy link
Member

@nscuro nscuro left a comment

Choose a reason for hiding this comment

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

Thanks @Shawyeok!

@nscuro nscuro added the defect Something isn't working label Jul 5, 2023
@nscuro nscuro added this to the 4.9 milestone Jul 5, 2023
@nscuro nscuro merged commit 730192d into DependencyTrack:master Jul 5, 2023
nscuro pushed a commit to DependencyTrack/hyades-apiserver that referenced this pull request Jul 10, 2023
Ported from DependencyTrack/dependency-track#2872

Co-authored-by: shawyeok <kmter@live.com>
Signed-off-by: nscuro <nscuro@protonmail.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
defect Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants