You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "He-Pin (via GitHub)" <gi...@apache.org> on 2026/04/18 18:31:57 UTC

[PR] fix: configurable ForkJoinPool minimum-runnable and LIFO stream dispatcher for JDK 21+ regression [pekko]

He-Pin opened a new pull request, #2871:
URL: https://github.com/apache/pekko/pull/2871

   ## Summary
   
   Addresses the JDK-8300995 ForkJoinPool regression on JDK 21+ described in #2870.
   
   This PR contains **two targeted configuration improvements** that mitigate FJP scheduling delays without changing any test assertions or element counts.
   
   ## Root Cause (JDK-8300995)
   
   ForkJoinPool with `asyncMode=true` (FIFO) on JDK 21+ fails to create compensation threads promptly when workers block on actor hand-offs. The FIFO ordering places response tasks at the *back* of the deque, causing cascading delays under load. This is especially visible in stream tests that involve MergeHub (`buffer=1`) or tight actor round-trips.
   
   ## Changes
   
   ### 1. Stream test dispatcher: LIFO task-peeking-mode
   
   `stream-testkit/src/test/resources/reference.conf`
   
   ```hocon
   pekko.test.stream-dispatcher {
     fork-join-executor {
       task-peeking-mode = "LIFO"  # response tasks go to front → resolved immediately
     }
   }
   ```
   
   **Why safe**: mailbox ordering is always FIFO; LIFO only affects how a *worker's own deque* is polled. No correctness impact. Standard actor dispatchers are unchanged.
   
   ### 2. Configurable `minimum-runnable` in ForkJoinPool
   
   `actor/src/main/resources/reference.conf`
   
   ```hocon
   fork-join-executor {
     minimum-runnable = 1   # JDK 9+ ForkJoinPool constructor param
   }
   ```
   
   `actor/src/main/scala/org/apache/pekko/dispatch/ForkJoinExecutorConfigurator.scala`
   
   - `PekkoForkJoinPool` receives a new `minimumRunnable: Int = 1` parameter
   - `ForkJoinExecutorServiceFactory` reads `minimum-runnable` from config
   - Default `1` preserves existing behaviour; users on JDK 21+ under heavy load can increase it
   
   **Binary compatibility**: Both new parameters carry default values and the class is `@InternalApi`, so there is no MiMa concern.
   
   ## Relation to other PRs
   
   - **#2869** — test stability fixes (timeout scaling, element count reduction) — *separate PR*
   - **#2870** — tracking issue for JDK-8300995; further work (`virtualize = on`) tracked there
   
   Closes #2870 (partially — `virtualize = on` remains future work)
   


-- 
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: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] feat: make ForkJoinPool minimum-runnable configurable and improve pool documentation [pekko]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin merged PR #2871:
URL: https://github.com/apache/pekko/pull/2871


-- 
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: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org