Flaky-test: V5StreamConsumerAckWatermarkTest.testAckCompletedBeforeARedeliveryDoesNotSuppressTheReack
Search before reporting
- I searched in the issues and found nothing similar.
Example failure
https://github.com/namest504/pulsar/actions/runs/35578528041/attempts/2 (CI - Unit - Brokers - Broker Group 2, on a fork PR whose diff does not touch the v5 client or the broker)
Exception stacktrace
Gradle suite > Gradle test > org.apache.pulsar.client.impl.v5.V5StreamConsumerAckWatermarkTest > testAckCompletedBeforeARedeliveryDoesNotSuppressTheReack FAILED
java.lang.AssertionError: missed message #0 expected object to not be null
at org.testng.Assert.fail(Assert.java:111)
at org.testng.Assert.assertNotNull(Assert.java:1496)
at org.apache.pulsar.client.impl.v5.V5StreamConsumerAckWatermarkTest.receiveAll(V5StreamConsumerAckWatermarkTest.java:109)
at org.apache.pulsar.client.impl.v5.V5StreamConsumerAckWatermarkTest.lambda$testAckCompletedBeforeARedeliveryDoesNotSuppressTheReack$0(V5StreamConsumerAckWatermarkTest.java:88)
at org.apache.pulsar.client.impl.v5.ScalableStreamConsumer.ackSegmentUpTo(ScalableStreamConsumer.java:372)
at org.apache.pulsar.client.impl.v5.ScalableStreamConsumer.acknowledgeCumulative(ScalableStreamConsumer.java:317)
at org.apache.pulsar.client.impl.v5.V5StreamConsumerAckWatermarkTest.testAckCompletedBeforeARedeliveryDoesNotSuppressTheReack(V5StreamConsumerAckWatermarkTest.java:93)What the broker logs of the failed run show, compared with a passing run:
- Passing:
Initiate reset readPosition (old 358:10 → new 358:-1)→Reset readPosition to before current readPosition→ the reconnected consumer rewinds to358:0and the 10 messages are redelivered. - Failing:
Initiate reset readPosition (old 357:10 → new 357:-1)→ noReset readPosition ...line at all → the reconnected consumer rewinds to357:10, the end of the segment, andreceive(5s)returns null.
The test writes the cumulative ack to the connection and then, from the consumer's before-watermark-update hook, calls PersistentSubscription.resetCursor(EARLIEST) directly on the broker. Under load the in-process reset overtakes the ack still in flight: the cursor queues the reset's mark-delete first and the ack's second (the cursor's metadata ledger is being created at that moment, so both are queued), and internalFlushPendingMarkDeletes persists only the last entry of the batch and runs only its post-persist action. The reset's read-position change is the one that is dropped; its callback still completes successfully, so resetCursor(...).get() returns and the test goes on to wait for a redelivery that never comes.
Are you willing to submit a PR?
- I'm willing to submit a PR!
Source: apache/pulsar