Skip to content

PHOENIX-8098 Fix race in ParallelPhoenixConnectionFailureTest - #2730

Open
apurtell wants to merge 1 commit into
apache:masterfrom
apurtell:PHOENIX-8098
Open

apurtell wants to merge 1 commit into
apache:masterfrom
apurtell:PHOENIX-8098

Conversation

@apurtell

@apurtell apurtell commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

The test of the query chain failure fails intermittently under CPU load. Each call on the parallel connection adds a link to a chain for each connection, and each link runs on the single-thread executor of its cluster. The caller returns when the second connection succeeds. Thus the failing link on the first connection can still be queued or running when the test checks it. Also, if that link runs only after the test restores the stub, it succeeds and the chain never fails. The product is not at fault, because it drops a failed connection asynchronously by design.

The change is test-only. The test now waits until the chain of the first connection fails, and only then restores the stub. The check is then deterministic.

🤖 Generated with Claude Code

Conn1's failure completes asynchronously on its single-thread executor,
but the test checked it at once. The test could also restore the stub
before conn1 ran its failing createStatement. Wait for conn1's chain to
complete exceptionally before restoring the stub. After that, every
later chain on conn1 fails at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The test-only synchronization change has no active review issues.

No open issues 🎉

What changed in this PR

Fixes an intermittent race in ParallelPhoenixConnectionFailureTest by synchronizing the test with asynchronous connection failure. Production behavior is unchanged.

Changes:

  • Waits for the first connection’s chain to complete exceptionally before restoring its stub.
  • Adds comments explaining why the wait is needed.
File Description
phoenix-core/​src/​test/​java/​org/​apache/​phoenix/​jdbc/​ParallelPhoenixConnectionFailureTest.java Adds a bounded wait to make the query-chain failure check deterministic.

Review effort: Balanced

@apurtell

apurtell commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

Precommit note: the failures in this run are not related to this change. Each one is a known problem on master.

(Claude Code)

@apurtell

apurtell commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

Update to the precommit note above: the region server deadlock after a table split is now PHOENIX-8121, with the fix in #2753. The metadata call for one table now runs on the caller thread, so it does not wait in the connection thread pool.

(Claude Code)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants