Skip to content

PHOENIX-8102 PhoenixMetricsIT reads task times before the pool thread records them - #2734

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

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

Conversation

@apurtell

@apurtell apurtell commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

The global query metrics test fails intermittently under CPU load at the check on the end-to-end task time. The client thread pool records task times only after the task future completes. Thus the client thread can get the scan result and read the metrics before the pool thread records them. The request-level check on task execution time has the same race. Query results are not affected.

The change is test-only. Before the existing checks, the test now waits, with a time limit, until the task timers record their values. If a value is too high, the existing check still fails. This change complements PHOENIX-8101, and the two patches apply in either order.

🤖 Generated with Claude Code

… records them

The client thread pool records the task execution and end-to-end times
in afterExecute(). ThreadPoolExecutor calls afterExecute() after the
task future completes. The client can therefore get the scan result and
read the metrics before the pool thread records them. Under CPU load
the woken client thread can preempt the pool thread, and the checks
then find no sample.

Wait, with a bounded poll, until the pool threads record the task
times. Then make the existing checks.

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

No active review issues remain for the test-only change that waits for task-timing metrics before asserting their values.

No open issues 🎉

What changed in this PR

This test-only change addresses intermittent timing-metric assertions in PhoenixMetricsIT by waiting for pool threads to record task times. Production behavior is unchanged.

Changes:

  • Adds bounded waits before global and request-level task-timing checks.
  • Preserves existing assertions to detect incorrect metric values.
File Description
phoenix-core/​src/​it/​java/​org/​apache/​phoenix/​monitoring/​PhoenixMetricsIT.java Waits for task timing metrics before asserting their values.

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.

  • After a table split, the region server of this test can deadlock. Its request handlers wait for metadata lookups that are queued in a small connection thread pool, and the threads of that pool wait for the same handlers. This is a Phoenix problem on master, and a fix will follow under a new JIRA.
  • The test coverage check fails on master for every change that runs the integration tests. Two region move variants of SortOrderIT run in two jobs, because the test runner also matches the test category of their parent class. PHOENIX-8104 ParallelStatsDisabledTest execution runs NeedsOwnMiniClusterTest cases twice #2736 fixes the test selection.

(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