Skip to content

[Ready] SOLR-18576: Wait for the expired ZooKeeper session before indexing in BasicDistributedZk2Test - #5206

Draft
nick-boss-tech wants to merge 3 commits into
apache:mainfrom
nick-boss-tech:solr-18576-submit-apache-main
Draft

nick-boss-tech wants to merge 3 commits into
apache:mainfrom
nick-boss-tech:solr-18576-submit-apache-main

Conversation

@nick-boss-tech

@nick-boss-tech nick-boss-tech commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

🤖 AI text below 🤖 (posted on behalf of Nick Shanin)

Ready for review, but held as a draft due to the project's open-PR cap; I'll mark it open on request.

https://issues.apache.org/jira/browse/SOLR-18576

What happens today

BasicDistributedZk2Test can index into a node whose ZooKeeper session has just expired, and the update fails with "Updates are disabled".

After ChaosMonkey.expireSession returns, the test calls blockUntilConnected and then indexes (test lines 152-164 at the merge base). expireSession returns once the client reports disconnected or its session id changes, but the expired-session event reaches Curator later. The wait can return before the event arrives, so the update races the expiry. In a CI run on #5194, the update was rejected with 503 "Cannot talk to ZooKeeper - Updates are disabled" 4 ms after the session-expired event was logged and 7 ms after ChaosMonkey started the expiry.

What this change does

The test waits for the expired-session event, then for reconnection, before it indexes.

A connection-state listener is registered before the session is expired. The test waits on a latch that counts down on the expired-session callback, then calls blockUntilConnected, and removes the listener before indexing. Only BasicDistributedZk2Test.java changes. Production code is unchanged.

Proof

The proof is inconclusive by construction: the race did not reproduce before or after the change, so these runs show the test still passes, not that the CI failure is gone.

  • BasicDistributedZk2Test, seed 7E5494314774A841 (the seed from the failing run): 1 test, 0 failures, 0 errors. Verified 2026-10-23 at head 4c8f12f526f.
  • BasicDistributedZk2Test, 4 random seeds: 4 tests, 0 failures, 0 errors. Verified 2026-10-23 at head 4c8f12f526f.
  • Module check :solr:core:check -x test passes at that head.

Limits

The race is timing-dependent, and the cause is inferred from the CI log, not confirmed by a failing run.

  • The test already allows up to 30 seconds for the expired-session event and then for reconnection. If either wait times out, the test fails at that wait, not at the update.
  • Other tests that call expireSession are not changed.
  • Changelog: none. The change is test-only.

AI-generated description. Nick Shanin directed the work and takes responsibility for this contribution.

@nick-boss-tech
nick-boss-tech force-pushed the solr-18576-submit-apache-main branch from 009498a to 4c8f12f Compare October 23, 2026 15:59
@nick-boss-tech nick-boss-tech changed the title SOLR-18576: Wait for the expired ZooKeeper session before indexing in BasicDistributedZk2Test [Ready] SOLR-18576: Wait for the expired ZooKeeper session before indexing in BasicDistributedZk2Test Oct 28, 2026
@nick-boss-tech
nick-boss-tech marked this pull request as draft October 28, 2026 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant