pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

Flaky-test: CurrentLedgerRolloverIfFullTest.testCurrentLedgerRolloverIfFull

Open lhotari opened this issue 1 year ago • 3 comments

Search before asking

  • [X] I searched in the issues and found nothing similar.

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?

  • [ ] I'm willing to submit a PR!

lhotari avatar Aug 13 '24 09:08 lhotari

@Technoboy- @mattisonchao Any ideas for fixing this?

lhotari avatar Aug 13 '24 09:08 lhotari

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

lhotari avatar Aug 13 '24 09:08 lhotari

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

marekczajkowski avatar Aug 23 '24 13:08 marekczajkowski

Fixed as part of #23311

lhotari avatar Oct 14 '24 11:10 lhotari