Skip to content

Flaky-test: KeySharedSubscriptionTest.testRemoveFirstConsumer #11426

Closed

Description

@lhotari

KeySharedSubscriptionTest is flaky. The testRemoveFirstConsumer test method fails sporadically.

example failure

  Error:  Tests run: 46, Failures: 1, Errors: 0, Skipped: 19, Time elapsed: 204.45 s <<< FAILURE! - in org.apache.pulsar.client.api.KeySharedSubscriptionTest
  Error:  testRemoveFirstConsumer(org.apache.pulsar.client.api.KeySharedSubscriptionTest)  Time elapsed: 0.228 s  <<< FAILURE!
  java.lang.AssertionError: expected [0] but found [10]
  	at org.testng.Assert.fail(Assert.java:99)
  	at org.testng.Assert.failNotEquals(Assert.java:1037)
  	at org.testng.Assert.assertEqualsImpl(Assert.java:140)
  	at org.testng.Assert.assertEquals(Assert.java:122)
  	at org.testng.Assert.assertEquals(Assert.java:907)
  	at org.testng.Assert.assertEquals(Assert.java:917)
  	at org.apache.pulsar.client.api.KeySharedSubscriptionTest.testRemoveFirstConsumer(KeySharedSubscriptionTest.java:685)
  	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
  	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
  	at org.testng.internal.InvokeMethodRunnable.runOne(InvokeMethodRunnable.java:45)
  	at org.testng.internal.InvokeMethodRunnable.call(InvokeMethodRunnable.java:73)
  	at org.testng.internal.InvokeMethodRunnable.call(InvokeMethodRunnable.java:11)
  	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
  	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
  	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
  	at java.base/java.lang.Thread.run(Thread.java:829)
  

Activity

  1. lhotari commented on Nov 17, 2021

    @lhotari
    MemberAuthor

    @Jason918 The problem isn't resolved. I'm reopening this issue. Here's a recent failure: https://github.com/apache/pulsar/runs/4236580815?check_suite_focus=true#step:9:3246 . It's a test run for PR #12853 and it included your attempt #12807 to fix the flaky test.

    Error:  Tests run: 50, Failures: 1, Errors: 0, Skipped: 23, Time elapsed: 221.229 s <<< FAILURE! - in org.apache.pulsar.client.api.KeySharedSubscriptionTest
      Error:  testRemoveFirstConsumer(org.apache.pulsar.client.api.KeySharedSubscriptionTest)  Time elapsed: 0.314 s  <<< FAILURE!
      java.lang.AssertionError: expected [0] but found [10]
      	at org.testng.Assert.fail(Assert.java:99)
      	at org.testng.Assert.failNotEquals(Assert.java:1037)
      	at org.testng.Assert.assertEqualsImpl(Assert.java:140)
      	at org.testng.Assert.assertEquals(Assert.java:122)
      	at org.testng.Assert.assertEquals(Assert.java:907)
      	at org.testng.Assert.assertEquals(Assert.java:917)
      	at org.apache.pulsar.client.api.KeySharedSubscriptionTest.testRemoveFirstConsumer(KeySharedSubscriptionTest.java:698)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
      	at org.testng.internal.InvokeMethodRunnable.runOne(InvokeMethodRunnable.java:45)
      	at org.testng.internal.InvokeMethodRunnable.call(InvokeMethodRunnable.java:73)
      	at org.testng.internal.InvokeMethodRunnable.call(InvokeMethodRunnable.java:11)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:829)
    
  2. Jason918 commented on Nov 17, 2021

    @Jason918
    Contributor

    Yes, I got reproduced locally. And I got a detailed DEBUG log. I will keep look into this.

  3. Jason918 commented on Nov 17, 2021

    @Jason918
    Contributor

    testRemoveFirstConsumer.log

    Debug level log here.
    Anyone familiar with KeyShare consuming mode could help.

  4. Jason918 commented on Nov 18, 2021

    @Jason918
    Contributor

    I have located this issue, and the test case is actually ok, but it caused by a race condition in PersistentDispatcherMultipleConsumers, which indeed would causing the unordered consuming.

    One can reproduce it easily in local environment by changing the 100ms to 1ms here.

    I would like submit an issue with detailed explanation about this.

  5. codelipenghui commented on Mar 4, 2022

    @codelipenghui
    Contributor

    The issue had no activity for 30 days, mark with Stale label.

  6. Jason918 commented on Mar 4, 2022

    @Jason918
    Contributor

    It's fixed by #12890.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions