Skip to content

Handle memory leaks from Mockito inline mocks#17070

Merged
gianm merged 1 commit intoapache:masterfrom
Akshat-Jain:mockito-test-jvm-heap
Sep 15, 2024
Merged

Handle memory leaks from Mockito inline mocks#17070
gianm merged 1 commit intoapache:masterfrom
Akshat-Jain:mockito-test-jvm-heap

Conversation

@Akshat-Jain
Copy link
Copy Markdown
Contributor

Description

In #17056, we increased the test JVM max heap from 2 GB to 2.5 GB as we were running into OOM issues in some tests. It was a temporary measure to unblock the CI/CD pipeline.

On digging into the heap dump, the issue seems similar to mockito/mockito#2503, and the suggestion was to use Mockito.framework().clearInlineMocks().

This PR adds Mockito.framework().clearInlineMocks() to MSQTestBase#AfterEach to handle the memory leaks from Mockito's inline mocks, and reduces the test JVM max heap back to 2 GB.


This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

@github-actions github-actions Bot added Area - Batch Ingestion Area - Dependencies Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262 labels Sep 15, 2024
@gianm gianm merged commit 6ed8632 into apache:master Sep 15, 2024
pranavbhole pushed a commit to pranavbhole/druid that referenced this pull request Sep 17, 2024
@AfterEach
public void tearDown2()
{
Mockito.framework().clearInlineMocks();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this leak-like usage is msq specific ; it could possibly be added to CalciteTestBase so that all Calcite*Test excercise this call

@adarshsanjeev adarshsanjeev added this to the 32.0.0 milestone Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area - Batch Ingestion Area - Dependencies Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants