Environment
- Dubbo version: master branch
- Operating System version: macos
- Java version: 1.8
Steps to reproduce this issue
./mvnw test -pl dubbo-cluster -Dtest=org.apache.dubbo.rpc.cluster.loadbalance.RoundRobinLoadBalanceTest
Expected Result
What do you expected from the above steps?
UT passed
Actual Result
What actually happens?
OOME thrown
If there is an exception, please attach the exception trace:
Running org.apache.dubbo.rpc.cluster.loadbalance.RoundRobinLoadBalanceTest
[29/11/18 12:24:27:027 CST] main INFO logger.LoggerFactory: using logger: org.apache.dubbo.common.logger.log4j.Log4jLoggerAdapter
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-6"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "surefire-forkedjvm-command-thread"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "last-ditch-daemon-shutdown-thread-30sec"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-5"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-1"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-10"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-7"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-9"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-2"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-3"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-8"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-4"
Tests run: 3, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 158.071 sec <<< FAILURE! - in org.apache.dubbo.rpc.cluster.loadbalance.RoundRobinLoadBalanceTest
org.apache.dubbo.rpc.cluster.loadbalance.RoundRobinLoadBalanceTest Time elapsed: 145.903 sec <<< ERROR!
java.lang.OutOfMemoryError: Java heap space
Results :
Tests in error:
RoundRobinLoadBalanceTest.org.apache.dubbo.rpc.cluster.loadbalance.RoundRobinLoadBalanceTest » OutOfMemory
Root cause analysis
Our mocked weightInvoker is recoding details of every single invocation which will consuming a lot of memory. please ref Mockito throws an OutOfMemoryError on a simple test
The maximum heap size of our test process specified in pom.xml is 512MB which is not enough for this test case (RoundRobinLoadBalanceTest#testSelectByWeight)
Solutions
- Option A, simply increase
-Xmx in argline
- Option B, mock weightInvoker$ with MockSettings
stubOnly
In my view, if the invoking details is not that necessary we can choose Option B.
And I will send a PR later.
Environment
Steps to reproduce this issue
./mvnw test -pl dubbo-cluster -Dtest=org.apache.dubbo.rpc.cluster.loadbalance.RoundRobinLoadBalanceTestExpected Result
What do you expected from the above steps?
UT passed
Actual Result
What actually happens?
OOME thrown
If there is an exception, please attach the exception trace:
Root cause analysis
Our mocked weightInvoker is recoding details of every single invocation which will consuming a lot of memory. please ref Mockito throws an OutOfMemoryError on a simple test
The maximum heap size of our test process specified in pom.xml is 512MB which is not enough for this test case (RoundRobinLoadBalanceTest#testSelectByWeight)
Solutions
-XmxinarglinestubOnlyIn my view, if the invoking details is not that necessary we can choose Option B.
And I will send a PR later.