You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "Akshat-Jain (via GitHub)" <gi...@apache.org> on 2024/09/15 13:27:57 UTC

[PR] Handle memory leaks from Mockito inline mocks (druid)

Akshat-Jain opened a new pull request, #17070:
URL: https://github.com/apache/druid/pull/17070

   ### Description
   
   In https://github.com/apache/druid/pull/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 https://github.com/mockito/mockito/issues/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.
   
   <hr>
   
   This PR has:
   
   - [x] 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](https://github.com/apache/druid/blob/master/dev/license.md)
   - [ ] 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](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met.
   - [ ] added integration tests.
   - [ ] been tested in a test Druid cluster.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Handle memory leaks from Mockito inline mocks (druid)

Posted by "gianm (via GitHub)" <gi...@apache.org>.
gianm merged PR #17070:
URL: https://github.com/apache/druid/pull/17070


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Handle memory leaks from Mockito inline mocks (druid)

Posted by "kgyrtkirk (via GitHub)" <gi...@apache.org>.
kgyrtkirk commented on code in PR #17070:
URL: https://github.com/apache/druid/pull/17070#discussion_r1765301660


##########
extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/test/MSQTestBase.java:
##########
@@ -381,6 +381,7 @@ public List<? extends com.fasterxml.jackson.databind.Module> getJacksonModules()
   @AfterEach
   public void tearDown2()
   {
+    Mockito.framework().clearInlineMocks();

Review Comment:
   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



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org