Skip to content

HBASE-30317 Fix synchronization race in TestExecutorService - #8531

Open
Sigma-Ma wants to merge 1 commit into
apache:masterfrom
Sigma-Ma:HBASE-30317-fix-testexecutorservice-wait-race
Open

HBASE-30317 Fix synchronization race in TestExecutorService#8531
Sigma-Ma wants to merge 1 commit into
apache:masterfrom
Sigma-Ma:HBASE-30317-fix-testexecutorservice-wait-race

Conversation

@Sigma-Ma

@Sigma-Ma Sigma-Ma commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

JIRA: https://issues.apache.org/jira/browse/HBASE-30317

What changes were proposed in this pull request?

Update TestExecutorService.testExecutorService to poll fresh ExecutorStatus snapshots with Waiter.waitFor until the status dump shows a handler waiting on the AtomicBoolean monitor.

The existing dump check now returns a boolean used as the wait predicate. No fixed sleep is introduced.

Why are the changes needed?

The test previously waited only for the shared counter to reach five. However, each handler increments the counter before performing its initial logging and entering lock.wait().

Therefore, counter == 5 proves only that all handlers have started. Under resource pressure, the status dump can be captured while all handlers are still RUNNABLE in StringConcatFactory.makeConcatWithConstants, causing the expected waiting-state assertion to fail.

Waiting for the expected state in the actual executor status dump removes this synchronization race.

How was this patch tested?

mvn \
  -pl hbase-server -am \
  -Dtest=org.apache.hadoop.hbase.executor.TestExecutorService \
  -Dsurefire.failIfNoSpecifiedTests=false \
  test

The resulting executor status dump showed all five handlers in the WAITING state on the AtomicBoolean monitor.

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.

1 participant