GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [fix][test] Fix flaky BacklogQuotaManagerTest.createNamespaces (HTTP 409 cascade) by lhotari · Pull Request #25680 · apache/pulsar

Conversation

@lhotari

@lhotari lhotari commented May 5, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Motivation

When CI runs BacklogQuotaManagerTest, two cases fail together as a cascade:

  1. BacklogQuotaManagerTest.clearNamespaces (the @AfterMethod) fails with org.awaitility.core.ConditionTimeoutException: Condition ... was not fulfilled within 10 seconds. while force-deleting prop/ns-quota.
  2. The next test method's @BeforeMethod createNamespaces then fails with PulsarAdminException$ConflictException: Namespace already exists (HTTP 409), because the prior cleanup never finished — and the same 409 keeps cascading for every subsequent test.

Example: https://github.com/apache/pulsar/actions/runs/25387367872/job/74455105884 (PR #25676 attempt 1; the failure is unrelated to that PR's change).

Root cause: PR #25624 added testConsumerBacklogEvictionSizeQuotaCleansPendingAcks and testConsumerBacklogEvictionTimeQuotaNotPreciseCleansPendingAcks, which leave Key_Shared consumers with unacked messages on prop/ns-quota and an active backlog-quota check loop running every 2s. Force-deleting that state can exceed the 10s default Awaitility budget used by MockedPulsarServiceBaseTest.deleteNamespaceWithRetry. The afterMethod times out, leftover metadata remains, and the next beforeMethod hits 409.

Modifications

  1. MockedPulsarServiceBaseTest.deleteNamespaceWithRetry now sets atMost(20, TimeUnit.SECONDS) instead of relying on Awaitility's 10s default. 2× headroom is enough for the heaviest cleanups while staying conservative for the many tests that share this helper.
  2. BacklogQuotaManagerTest.createNamespaces is split: a new createNamespaceForTest(String) helper catches PulsarAdminException.ConflictException and recovers by force-deleting the leftover and recreating. Defense in depth — even if cleanup ever exceeds the 20s budget, the next test starts with clean state instead of cascading 409s.

Verifying this change

  • Make sure that the change passes the CI checks.

This change is already covered by existing tests, such as BacklogQuotaManagerTest.testConsumerBacklogEvictionSizeQuotaCleansPendingAcks and BacklogQuotaManagerTest.testConsumerBacklogEvictionTimeQuotaNotPreciseCleansPendingAcks (the two heavy tests that exposed the cascade). Verified locally with @Test(invocationCount = 10) on both: 20/20 passes, all clearNamespaces cycles within the new 20s budget.

Does this pull request potentially affect one of the following parts:

  • 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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@lhotari
lhotari requested review from Technoboy-, dao-jun, merlimat and nodece May 5, 2026 21:14
@lhotari
[fix][test] Fix flaky BacklogQuotaManagerTest.createNamespaces (HTTP …
6f792e5
…409 cascade)

Two `BacklogQuotaManagerTest` cases consistently fail together: an
`@AfterMethod` `clearNamespaces` times out at 10s while force-deleting
`prop/ns-quota`, leaving the namespace in metadata; the next test's
`@BeforeMethod` `createNamespaces` then hits HTTP 409 ("Namespace already
exists") and the cascade continues for every subsequent test.

Root cause: PR apache#25624 added two pending-acks tests that leave Key_Shared
consumers with unacked messages on `prop/ns-quota` and an active
backlog-quota check loop running every 2s. Force-deleting that state can
exceed the 10s default `Awaitility` budget used by the shared
`MockedPulsarServiceBaseTest.deleteNamespaceWithRetry`. The afterMethod
times out, leftover metadata remains, and the next beforeMethod hits 409.

Fix:
1. `MockedPulsarServiceBaseTest.deleteNamespaceWithRetry` now uses
   `atMost(20, SECONDS)` instead of relying on the Awaitility 10s
   default. 2× headroom is enough for the heaviest cleanups in this
   class while staying conservative for the many tests that share this
   helper.
2. `BacklogQuotaManagerTest.createNamespaces` is split into a helper
   that catches `ConflictException` and recovers by force-deleting the
   leftover and recreating, so a slow prior cleanup cannot cascade as a
   409 — defense in depth on top of (1).

Verified locally with `@Test(invocationCount = 10)` on the two new
pending-acks tests: 20/20 passes, all `clearNamespaces` cycles within
the new 20s budget.
@lhotari
lhotari force-pushed the lh-fix-flaky-BacklogQuotaManagerTest branch from 60c77ed to 6f792e5 Compare May 5, 2026 22:02
merlimat
merlimat approved these changes May 5, 2026
View reviewed changes
This was referenced May 5, 2026
[fix][broker] Skip backlog-quota eviction on fenced/closing topics #25684
Merged
Distinguish topic close vs delete state and apply consistent guards in scheduled jobs and admin APIs #25688
Open
dao-jun
dao-jun approved these changes May 6, 2026
View reviewed changes
@merlimat
merlimat merged commit 02d12a6 into apache:master May 6, 2026
154 of 160 checks passed

Uh oh!

There was an error while loading. Please reload this page.

poorbarcode pushed a commit to poorbarcode/pulsar that referenced this pull request May 6, 2026
@lhotari @poorbarcode
[fix][test] Fix flaky BacklogQuotaManagerTest.createNamespaces (HTTP …
6d7cf17
…409 cascade) (apache#25680)
@lhotari lhotari added this to the 5.0.0-M1 milestone Jun 12, 2026
dao-jun added a commit to ascentstream/pulsar that referenced this pull request Oct 5, 2026
@dao-jun
[fix][test] Extend deleteNamespaceWithRetry timeout to 20 seconds
0e518b4
Surgical backport of the MockedPulsarServiceBaseTest change from apache#25680:
deleteNamespaceWithRetry relied on Awaitility's default 10-second timeout,
so a starved-out cleanup cascaded into dozens of 'admin is null' failures
under CI load (e.g. TopicEventsListenerTest 24-failure cascades).
The BacklogQuotaManagerTest portion of apache#25680 is not carried over: this
branch already has the richer createNamespaceForTest handling from apache#26313.

(cherry picked from commit 02d12a6)

Partial pick: only the MockedPulsarServiceBaseTest line.
nodece pushed a commit to ascentstream/pulsar that referenced this pull request Oct 13, 2026
@dao-jun @nodece
[fix][test] Extend deleteNamespaceWithRetry timeout to 20 seconds
6b12f83
Surgical backport of the MockedPulsarServiceBaseTest change from apache#25680:
deleteNamespaceWithRetry relied on Awaitility's default 10-second timeout,
so a starved-out cleanup cascaded into dozens of 'admin is null' failures
under CI load (e.g. TopicEventsListenerTest 24-failure cascades).
The BacklogQuotaManagerTest portion of apache#25680 is not carried over: this
branch already has the richer createNamespaceForTest handling from apache#26313.

(cherry picked from commit 02d12a6)

Partial pick: only the MockedPulsarServiceBaseTest line.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@merlimat merlimat merlimat approved these changes
@dao-jun dao-jun dao-jun approved these changes
@nodece nodece Awaiting requested review from nodece
@Technoboy- Technoboy- Awaiting requested review from Technoboy-

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

5.0.0-M1

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@lhotari @merlimat @dao-jun
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.