This is an automated email from the ASF dual-hosted git repository. ddiederen pushed a commit to branch branch-3.7.0 in repository https://gitbox.apache.org/repos/asf/zookeeper.git
commit 6a8c799e0b8ecb083439159f2d70d4e0cb02e722 Author: Damien Diederen <[email protected]> AuthorDate: Thu Feb 18 08:40:55 2021 +0000 ZOOKEEPER-4199: Avoid thread leak in QuorumRequestPipelineTest `QuorumRequestPipelineTest` hosts parameterized tests which explicitly call `QuorumBase.setUp(boolean)`. This patch overrides the argument-less `QuorumBase.setUp()` with an empty body, as the former is annotated `BeforeEach`-otherwise causing the runtime to start a fresh 5-ensemble before each test. Without the override, one such extraneous ensemble is created and immediately leaked for each combination of test method + parameters. The test consequently requires 4000+ simultaneous threads to complete, and while Linux happily handles that load, macOS Catalina's per-process limit of 2048 threads effectively causes the JVM to "crash" or lock up. The solution is copied verbatim from another parameterized subclass of `QuorumBase`, `EagerACLFilterTest`. Author: Damien Diederen <[email protected]> Reviewers: Enrico Olivelli <[email protected]>, Mate Szalay-Beko <[email protected]> Closes #1591 from ztzg/ZOOKEEPER-4199-thread-leak-qrp-test --- .../apache/zookeeper/server/quorum/QuorumRequestPipelineTest.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/QuorumRequestPipelineTest.java b/zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/QuorumRequestPipelineTest.java index 8a463c0..0888d6f 100644 --- a/zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/QuorumRequestPipelineTest.java +++ b/zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/QuorumRequestPipelineTest.java @@ -36,6 +36,7 @@ import org.apache.zookeeper.data.Stat; import org.apache.zookeeper.server.quorum.QuorumPeer.ServerState; import org.apache.zookeeper.test.QuorumBase; import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; @@ -59,6 +60,13 @@ public class QuorumRequestPipelineTest extends QuorumBase { Arguments.of(ServerState.OBSERVING)); } + @BeforeEach + @Override + public void setUp() { + //since parameterized test methods need a parameterized setUp method + //the inherited method has to be overridden with an empty function body + } + public void setUp(ServerState serverState) throws Exception { CountdownWatcher clientWatch = new CountdownWatcher(); super.setUp(true);
