You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "lhotari (via GitHub)" <gi...@apache.org> on 2026/09/30 21:19:40 UTC
[PR] [fix][test] Fix flaky V5CumulativeAckTest.testRetryingAnAckThatFailedWhileDisconnectedAdvancesTheCursor [pulsar]
lhotari opened a new pull request, #26789:
URL: https://github.com/apache/pulsar/pull/26789
### Motivation
`V5CumulativeAckTest.testRetryingAnAckThatFailedWhileDisconnectedAdvancesTheCursor` is flaky. It failed in CI on #26778 ([job log](https://github.com/apache/pulsar/actions/runs/36737551378/job/110036098668)):
```
java.lang.AssertionError: an ack sent without a connection must not count as done expected [true] but found [false]
at org.apache.pulsar.client.api.v5.V5CumulativeAckTest.testRetryingAnAckThatFailedWhileDisconnectedAdvancesTheCursor(V5CumulativeAckTest.java:367)
```
The test disconnects the consumer on the broker side, waits until the subscription has no consumers, and then acks, expecting the ack not to reach the broker. But the client reconnects on its own after a backoff of about 100 ms. Once it sends the new Subscribe, the consumer has a connection again. An ack issued in the window before the broker has re-added the consumer goes out on that connection right behind the Subscribe, so the broker processes it and the cursor moves. There is no bug in the production code; the test's disconnect doesn't reliably keep the consumer off the broker.
A longer reconnect backoff on a dedicated client would have been the simplest way to widen that window, but `ConnectionPolicy.connectionBackoff` is currently ignored by the V5 client (#26788).
### Modifications
- The test now fences the subscription and disconnects its consumers with `PersistentSubscription.close(true, Optional.empty())`. It issues the ack while the fence is up and then calls `resumeAfterFence()`. While fenced, the broker rejects the client's re-subscribe, so the ack can't reach the cursor however the reconnect is timed.
- The test scenario and all assertions are unchanged.
### Verifying this change
- [ ] Make sure that the change passes the CI checks.
This change is already covered by existing tests, such as `V5CumulativeAckTest.testRetryingAnAckThatFailedWhileDisconnectedAdvancesTheCursor`. Verified locally:
- The original code with a 500 ms sleep before the ack, to force the race, fails with the same assertion as in CI.
- The fixed code with the same 500 ms sleep passes 5/5.
- The fixed code without the sleep passes 10/10 with `invocationCount = 10`, along with the other tests in the class.
### Does this pull request potentially affect one of the following parts:
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
*If the box was checked, please highlight the changes*
- [ ] Dependencies (add or upgrade a dependency)
- [ ] The public API
- [ ] The schema
- [ ] The default values of configurations
- [ ] The threading model
- [ ] The binary protocol
- [ ] The REST endpoints
- [ ] The admin CLI options
- [ ] The metrics
- [ ] Anything that affects deployment
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][test] Fix flaky V5CumulativeAckTest.testRetryingAnAckThatFailedWhileDisconnectedAdvancesTheCursor [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari merged PR #26789:
URL: https://github.com/apache/pulsar/pull/26789
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org