apache / pulsar

Apache Pulsar - distributed pub-sub messaging system
https://pulsar.apache.org/
Apache License 2.0
14.12k stars 3.57k forks source link

Flaky-test: CurrentLedgerRolloverIfFullTest.testCurrentLedgerRolloverIfFull #23161

Open lhotari opened 1 month ago

lhotari commented 1 month ago

Search before asking

Example failures

Exception stacktrace

java.lang.AssertionError: expected [5] but found [6]
    at org.testng.Assert.fail(Assert.java:110)
    at org.testng.Assert.failNotEquals(Assert.java:1577)
    at org.testng.Assert.assertEqualsImpl(Assert.java:149)
    at org.testng.Assert.assertEquals(Assert.java:131)
    at org.testng.Assert.assertEquals(Assert.java:1418)
    at org.testng.Assert.assertEquals(Assert.java:1382)
    at org.testng.Assert.assertEquals(Assert.java:1428)
    at org.apache.pulsar.broker.service.CurrentLedgerRolloverIfFullTest.testCurrentLedgerRolloverIfFull(CurrentLedgerRolloverIfFullTest.java:84)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:569)
    at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
    at org.testng.internal.invokers.InvokeMethodRunnable.runOne(InvokeMethodRunnable.java:47)
    at org.testng.internal.invokers.InvokeMethodRunnable.call(InvokeMethodRunnable.java:76)
    at org.testng.internal.invokers.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:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:840)

Are you willing to submit a PR?

lhotari commented 1 month ago

@Technoboy- @mattisonchao Any ideas for fixing this?

lhotari commented 1 month ago

more failures in https://github.com/lhotari/pulsar-flakes/blob/master/2024-08-13-7d-master/org.apache.pulsar.broker.service.CurrentLedgerRolloverIfFullTest.testCurrentLedgerRolloverIfFull.md

marekczajkowski commented 3 weeks ago

There is a race condition in this test CurrentLedgerRolloverIfFullTest#testCurrentLedgerRolloverIfFull Please find attached screenshot. As you can see there is maxEntriesPerLedger=2 and than 10 messages are sent. That would mean we have 5 ledgers each with 2 messages. Then a new ledger is being created to accept next upcoming messages but in many cases it does not happen until assertion is done which compares ledgers to 5 see commented out code. I believe it should wait for this new ledger and than compare the correct number of 6 ledgers

Zrzut ekranu 2024-08-23 o 15 43 05