Skip to content

fix: support virtualized dispatcher test assumptions#2912

Open
He-Pin wants to merge 1 commit intoapache:mainfrom
He-Pin:fix-nightly-virtual-thread-test-assumptions
Open

fix: support virtualized dispatcher test assumptions#2912
He-Pin wants to merge 1 commit intoapache:mainfrom
He-Pin:fix-nightly-virtual-thread-test-assumptions

Conversation

@He-Pin
Copy link
Copy Markdown
Member

@He-Pin He-Pin commented Apr 25, 2026

Motivation:
Nightly builds can enable virtualized fork-join dispatchers on newer JDKs. That legitimately changes observable dispatcher thread names and disables Dispatcher batching, so tests that asserted numeric worker suffixes or default-dispatcher batching failed.

Modification:

  • Accept both platform-thread and virtual-thread dispatcher name suffixes in thread-name assertions.
  • Keep production virtual-thread naming unchanged.
  • Run ExecutionContext batching checks on a dedicated non-virtualized dispatcher.

Result:
Nightly can virtualize the default and internal dispatchers while the affected tests still validate their intended behavior on JDK 17, JDK 21, and JDK 25.

Tests:

  • JDK 25: sbt -Dpekko.test.timefactor=4 -Dpekko.actor.testkit.typed.timefactor=4 -Dpekko.actor.default-dispatcher.fork-join-executor.minimum-runnable=8 -Dpekko.actor.internal-dispatcher.fork-join-executor.minimum-runnable=8 -Dpekko.actor.default-dispatcher.fork-join-executor.virtualize=on -Dpekko.actor.internal-dispatcher.fork-join-executor.virtualize=on "slf4j / Test / testOnly org.apache.pekko.event.slf4j.Slf4jLoggerSpec" "actor-tests / Test / testOnly org.apache.pekko.actor.dispatch.DispatchersSpec org.apache.pekko.dispatch.ExecutionContextSpec"
  • JDK 21: sbt -Dpekko.test.timefactor=2 -Dpekko.actor.testkit.typed.timefactor=2 -Dpekko.actor.default-dispatcher.fork-join-executor.minimum-runnable=4 -Dpekko.actor.internal-dispatcher.fork-join-executor.minimum-runnable=4 -Dpekko.actor.default-dispatcher.fork-join-executor.virtualize=on -Dpekko.actor.internal-dispatcher.fork-join-executor.virtualize=on "slf4j / Test / testOnly org.apache.pekko.event.slf4j.Slf4jLoggerSpec" "actor-tests / Test / testOnly org.apache.pekko.actor.dispatch.DispatchersSpec org.apache.pekko.dispatch.ExecutionContextSpec"
  • JDK 21 / Scala 3.3.x: sbt -Dpekko.test.timefactor=2 -Dpekko.actor.testkit.typed.timefactor=2 -Dpekko.actor.default-dispatcher.fork-join-executor.minimum-runnable=4 -Dpekko.actor.internal-dispatcher.fork-join-executor.minimum-runnable=4 -Dpekko.actor.default-dispatcher.fork-join-executor.virtualize=on -Dpekko.actor.internal-dispatcher.fork-join-executor.virtualize=on "++ 3.3.x" "slf4j / Test / testOnly org.apache.pekko.event.slf4j.Slf4jLoggerSpec" "actor-tests / Test / testOnly org.apache.pekko.actor.dispatch.DispatchersSpec org.apache.pekko.dispatch.ExecutionContextSpec"
  • JDK 17: sbt -Dpekko.test.timefactor=2 -Dpekko.actor.testkit.typed.timefactor=2 "slf4j / Test / testOnly org.apache.pekko.event.slf4j.Slf4jLoggerSpec" "actor-tests / Test / testOnly org.apache.pekko.actor.dispatch.DispatchersSpec org.apache.pekko.dispatch.ExecutionContextSpec"
  • sbt "slf4j / Test / scalafmt" "actor-tests / Test / scalafmtCheck" "slf4j / Test / scalafmtCheck"
  • git diff --check

References:

Motivation:
Nightly builds can enable virtualized fork-join dispatchers on newer JDKs. That legitimately changes observable dispatcher thread names and disables Dispatcher batching, so tests that asserted numeric worker suffixes or default-dispatcher batching failed.

Modification:
- Accept both platform-thread and virtual-thread dispatcher name suffixes in thread-name assertions.
- Keep production virtual-thread naming unchanged.
- Run ExecutionContext batching checks on a dedicated non-virtualized dispatcher.

Result:
Nightly can virtualize the default and internal dispatchers while the affected tests still validate their intended behavior on JDK 17, JDK 21, and JDK 25.

Tests:
- JDK 25: sbt -Dpekko.test.timefactor=4 -Dpekko.actor.testkit.typed.timefactor=4 -Dpekko.actor.default-dispatcher.fork-join-executor.minimum-runnable=8 -Dpekko.actor.internal-dispatcher.fork-join-executor.minimum-runnable=8 -Dpekko.actor.default-dispatcher.fork-join-executor.virtualize=on -Dpekko.actor.internal-dispatcher.fork-join-executor.virtualize=on "slf4j / Test / testOnly org.apache.pekko.event.slf4j.Slf4jLoggerSpec" "actor-tests / Test / testOnly org.apache.pekko.actor.dispatch.DispatchersSpec org.apache.pekko.dispatch.ExecutionContextSpec"
- JDK 21: sbt -Dpekko.test.timefactor=2 -Dpekko.actor.testkit.typed.timefactor=2 -Dpekko.actor.default-dispatcher.fork-join-executor.minimum-runnable=4 -Dpekko.actor.internal-dispatcher.fork-join-executor.minimum-runnable=4 -Dpekko.actor.default-dispatcher.fork-join-executor.virtualize=on -Dpekko.actor.internal-dispatcher.fork-join-executor.virtualize=on "slf4j / Test / testOnly org.apache.pekko.event.slf4j.Slf4jLoggerSpec" "actor-tests / Test / testOnly org.apache.pekko.actor.dispatch.DispatchersSpec org.apache.pekko.dispatch.ExecutionContextSpec"
- JDK 21 / Scala 3.3.x: sbt -Dpekko.test.timefactor=2 -Dpekko.actor.testkit.typed.timefactor=2 -Dpekko.actor.default-dispatcher.fork-join-executor.minimum-runnable=4 -Dpekko.actor.internal-dispatcher.fork-join-executor.minimum-runnable=4 -Dpekko.actor.default-dispatcher.fork-join-executor.virtualize=on -Dpekko.actor.internal-dispatcher.fork-join-executor.virtualize=on "++ 3.3.x" "slf4j / Test / testOnly org.apache.pekko.event.slf4j.Slf4jLoggerSpec" "actor-tests / Test / testOnly org.apache.pekko.actor.dispatch.DispatchersSpec org.apache.pekko.dispatch.ExecutionContextSpec"
- JDK 17: sbt -Dpekko.test.timefactor=2 -Dpekko.actor.testkit.typed.timefactor=2 "slf4j / Test / testOnly org.apache.pekko.event.slf4j.Slf4jLoggerSpec" "actor-tests / Test / testOnly org.apache.pekko.actor.dispatch.DispatchersSpec org.apache.pekko.dispatch.ExecutionContextSpec"
- sbt "slf4j / Test / scalafmt" "actor-tests / Test / scalafmtCheck" "slf4j / Test / scalafmtCheck"
- git diff --check

References:
- apache#2907
- https://github.com/apache/pekko/actions/runs/24933645620
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