[fix][test] Fix flaky AdminApiTest.persistentTopicsCursorResetAfterReset timeout#25692
Open
merlimat wants to merge 1 commit intoapache:masterfrom
Open
[fix][test] Fix flaky AdminApiTest.persistentTopicsCursorResetAfterReset timeout#25692merlimat wants to merge 1 commit intoapache:masterfrom
merlimat wants to merge 1 commit intoapache:masterfrom
Conversation
…set timeout
The test calls `consumer.receive()` (no timeout) inside a loop after
`admin.topics().resetCursor(...)`. If the broker doesn't push the
expected redelivery in time, the consumer blocks indefinitely on
`GrowableArrayBlockingQueue.take()` until the 5-minute test timeout
fires:
```
ThreadTimeoutException: Method
o.a.p.b.admin.AdminApiTest.persistentTopicsCursorResetAfterReset()
didn't finish within the time-out 300000
at j.u.c.locks.LockSupport.park(LockSupport.java:371)
at o.a.p.c.u.collections.GrowableArrayBlockingQueue.take(...)
at o.a.p.c.impl.ConsumerImpl.internalReceive(ConsumerImpl.java:531)
at o.a.p.c.impl.ConsumerBase.receive(ConsumerBase.java:282)
at AdminApiTest.persistentTopicsCursorResetAfterReset(:2945)
```
Switch every `consumer.receive()` in this test to
`receive(30, TimeUnit.SECONDS)` and assert the message is non-null
with a descriptive message. Now if the redelivery genuinely doesn't
arrive, the test fails fast (in 30s) with a clear diagnostic instead
of hanging for the full 5-minute timeout.
dao-jun
approved these changes
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
AdminApiTest.persistentTopicsCursorResetAfterResetflakes by hitting the 5-minute test-method timeout:The test uses
consumer.receive()(no timeout) inside a loop afteradmin.topics().resetCursor(...). If the broker doesn't push the redelivery in time, the consumer blocks indefinitely until the test method timeout fires.Failing test scan: https://scans.gradle.com/s/tihvvhomboopa/tests/task/:pulsar-broker:test/details/org.apache.pulsar.broker.admin.AdminApiTest/persistentTopicsCursorResetAfterReset%5B4%5D(simple-topicName)/1/output
Modifications
Replace every
consumer.receive()in this test withconsumer.receive(30, TimeUnit.SECONDS)and assert the result is non-null with a descriptive message. The test now fails fast in ~30 seconds with a clear diagnostic identifying whichresetCursorstep did not deliver, instead of hanging for the full 5-minute timeout.Verifying this change
AdminApiTest.persistentTopicsCursorResetAfterResetpasses locally with the change.Does this pull request potentially affect one of the following parts: