You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2022/07/12 13:14:06 UTC

[pulsar] branch master updated: [fix][test] Fix jvm oom on Unit Test broker group 1 (#16542)

This is an automated email from the ASF dual-hosted git repository.

penghui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 3752a1170bd [fix][test] Fix jvm oom on Unit Test broker group 1 (#16542)
3752a1170bd is described below

commit 3752a1170bd7b362901c3e792548c62352b4b1ad
Author: lipenghui <pe...@apache.org>
AuthorDate: Tue Jul 12 21:13:56 2022 +0800

    [fix][test] Fix jvm oom on Unit Test broker group 1 (#16542)
---
 .../pulsar/client/api/MultiTopicsConsumerTest.java | 32 ++++++++++------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/MultiTopicsConsumerTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/MultiTopicsConsumerTest.java
index 14d818ce3be..75b315413f5 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/MultiTopicsConsumerTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/MultiTopicsConsumerTest.java
@@ -65,11 +65,17 @@ public class MultiTopicsConsumerTest extends ProducerConsumerBase {
         super.internalCleanup();
     }
 
-    @Override
-    protected PulsarClient createNewPulsarClient(ClientBuilder clientBuilder) throws PulsarClientException {
-        ClientConfigurationData conf =
-                ((ClientBuilderImpl) clientBuilder).getClientConfigurationData();
-        return new PulsarClientImpl(conf) {
+    // test that reproduces the issue https://github.com/apache/pulsar/issues/12024
+    // where closing the consumer leads to an endless receive loop
+    @Test
+    public void testMultiTopicsConsumerCloses() throws Exception {
+        String topicNameBase = "persistent://my-property/my-ns/my-topic-consumer-closes-";
+
+        ClientConfigurationData conf = ((ClientBuilderImpl) PulsarClient.builder().serviceUrl(lookupUrl.toString()))
+                .getClientConfigurationData();
+
+        @Cleanup
+        PulsarClientImpl client = new PulsarClientImpl(conf) {
             {
                 ScheduledExecutorService internalExecutorService =
                         (ScheduledExecutorService) super.getScheduledExecutorProvider().getExecutor();
@@ -85,31 +91,23 @@ public class MultiTopicsConsumerTest extends ProducerConsumerBase {
                 return internalExecutorServiceDelegate;
             }
         };
-    }
-
-    // test that reproduces the issue https://github.com/apache/pulsar/issues/12024
-    // where closing the consumer leads to an endless receive loop
-    @Test
-    public void testMultiTopicsConsumerCloses() throws Exception {
-        String topicNameBase = "persistent://my-property/my-ns/my-topic-consumer-closes-";
-
         @Cleanup
-        Producer<byte[]> producer1 = pulsarClient.newProducer()
+        Producer<byte[]> producer1 = client.newProducer()
                 .topic(topicNameBase + "1")
                 .enableBatching(false)
                 .create();
         @Cleanup
-        Producer<byte[]> producer2 = pulsarClient.newProducer()
+        Producer<byte[]> producer2 = client.newProducer()
                 .topic(topicNameBase + "2")
                 .enableBatching(false)
                 .create();
         @Cleanup
-        Producer<byte[]> producer3 = pulsarClient.newProducer()
+        Producer<byte[]> producer3 = client.newProducer()
                 .topic(topicNameBase + "3")
                 .enableBatching(false)
                 .create();
 
-        Consumer<byte[]> consumer = pulsarClient
+        Consumer<byte[]> consumer = client
                 .newConsumer()
                 .topics(Lists.newArrayList(topicNameBase + "1", topicNameBase + "2", topicNameBase + "3"))
                 .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest)