He-Pin opened a new pull request, #2949: URL: https://github.com/apache/pekko/pull/2949
## Summary Two unrelated flaky tests surfaced again on the nightly schedule (run [25586760215](https://github.com/apache/pekko/actions/runs/25586760215) failed; the manually triggered [25580301468](https://github.com/apache/pekko/actions/runs/25580301468) on the same commit passed). Both fail intermittently on JDK 21/25 with virtualized dispatchers. - **MetricsBasedResizerSpec — "record the performance log with the correct pool size"**: between the two `reportMessageCount` checkpoints the test sent only one extra `mockSend` per routee. With virtual-thread scheduling those messages can finish before the second checkpoint runs, leaving routees idle (`currentMessage = null`), so the resizer's `fullyUtilized` check never holds and `performanceLog` stays empty — failing with `None was empty (MetricsBasedResizerSpec.scala:245)` after ~12s. Fixed by using a second `sendToAll(await=false)` and awaiting the first latch, which keeps both routees actively holding `currentMessage` during both checkpoints. - **FlowMapWithResourceSpec — "will close the autocloseable resource on abrupt materializer termination"**: `mapWithResource` carries the `IODispatcher` attribute, so it lands on a different dispatcher than `Source.single`/`Sink.never` and the materializer introduces an async-island bridge. The bridge's `SubSink` can pull eagerly; once the pull propagates back, `Source.single` pushes and completes, `StatefulMap.onUpstreamFinish` runs, `closeStateAndComplete` invokes the close callback and `closedCounter` reaches 1 in 22–115 ms — before the test thread issues `mat.shutdown()`. The pre-shutdown `closedCounter.get shouldBe 0` is a timing assumption that doesn't reflect the operator's contract. Removed it; the abrupt-termination guarantee is still verified by the `AbruptTerminationException` and `promise.future`/`closedCounter == 1` checks. ## Test plan - [x] `actor-tests/testOnly org.apache.pekko.routing.MetricsBasedResizerSpec` passes locally - [x] `stream-tests/testOnly org.apache.pekko.stream.scaladsl.FlowMapWithResourceSpec` passes locally - [x] `sbt scalafmtAll` clean - [ ] Nightly virtualized run on JDK 21 / 25 stays green -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
