This is an automated email from the ASF dual-hosted git repository.

He-Pin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko.git


The following commit(s) were added to refs/heads/main by this push:
     new b24d1045e1 fix: stabilize async DNS dispatchers under low 
minimum-runnable (#2895)
b24d1045e1 is described below

commit b24d1045e11e3cfcfe12218d40b8eff6fbb90de5
Author: He-Pin(kerr) <[email protected]>
AuthorDate: Fri Apr 24 15:37:37 2026 +0800

    fix: stabilize async DNS dispatchers under low minimum-runnable (#2895)
    
    * fix: stabilize async dns dispatchers
    
    Motivation:
    The async DNS discovery path started timing out when fork-join 
minimum-runnable was allowed to auto-resolve to a lower value. The failing 
docs.discovery.DnsDiscoveryDocSpec showed that the isolated SD-DNS lookup path 
became much more sensitive to dispatcher starvation under that policy.
    
    Modification:
    Keep the internal dispatcher on an explicit minimum-runnable floor and 
route both IO-DNS and SD-DNS async-dns routees through the configured DNS 
dispatcher instead of leaving the routees on the default dispatcher. Add a 
regression assertion that the built-in internal dispatcher keeps its explicit 
compensation floor.
    
    Result:
    Async DNS lookups no longer fall back to a starvation-prone routee 
dispatcher, and the DNS discovery docs regression passes again under 
minimum-runnable=-1.
    
    References:
    https://github.com/apache/pekko/actions/runs/24863583862/job/72794553815
    
    Co-authored-by: Copilot <[email protected]>
    
    * fix: keep internal dispatcher on auto minimum-runnable
    
    Motivation:
    The async DNS routee dispatcher wiring is sufficient to stabilize the DNS 
discovery path, so keeping an extra hard-coded minimum-runnable floor on the 
internal dispatcher is broader than necessary.
    
    Modification:
    Restore the internal dispatcher setting to minimum-runnable = -1 and adjust 
the regression spec so it verifies that the built-in internal dispatcher 
follows its own configured auto policy instead of asserting a fixed value.
    
    Result:
    The narrower fix still keeps docs.discovery.DnsDiscoveryDocSpec green under 
minimum-runnable=-1 while avoiding an unnecessary global compensation override 
for the internal dispatcher.
---
 .../pekko/dispatch/ForkJoinExecutorConfiguratorSpec.scala   | 13 +++++++++++++
 actor/src/main/resources/reference.conf                     |  5 +++++
 discovery/src/main/resources/reference.conf                 |  5 ++++-
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git 
a/actor-tests/src/test/scala/org/apache/pekko/dispatch/ForkJoinExecutorConfiguratorSpec.scala
 
b/actor-tests/src/test/scala/org/apache/pekko/dispatch/ForkJoinExecutorConfiguratorSpec.scala
index 20e4ea2a77..913b7752f5 100644
--- 
a/actor-tests/src/test/scala/org/apache/pekko/dispatch/ForkJoinExecutorConfiguratorSpec.scala
+++ 
b/actor-tests/src/test/scala/org/apache/pekko/dispatch/ForkJoinExecutorConfiguratorSpec.scala
@@ -155,6 +155,19 @@ class ForkJoinExecutorConfiguratorSpec extends 
PekkoSpec(ForkJoinExecutorConfigu
       resolvedMinimumRunnable("fj-explicit-seven-dispatcher") shouldBe 7
     }
 
+    "let the built-in internal dispatcher use its own auto policy" in {
+      val dispatcherConfig =
+        
system.dispatchers.config("pekko.actor.internal-dispatcher").getConfig("fork-join-executor")
+      val parallelism = ThreadPoolConfig.scaledPoolSize(
+        dispatcherConfig.getInt("parallelism-min"),
+        dispatcherConfig.getDouble("parallelism-factor"),
+        dispatcherConfig.getInt("parallelism-max"))
+      resolvedMinimumRunnable("pekko.actor.internal-dispatcher") shouldBe 
resolveMinimumRunnable(
+        configured = dispatcherConfig.getInt("minimum-runnable"),
+        parallelism = parallelism,
+        jdkMajorVersion = JavaVersion.majorVersion)
+    }
+
     "auto-scale the default (minimum-runnable not set) on JDK 25+" in {
       if (JavaVersion.majorVersion < 25) pending
 
diff --git a/actor/src/main/resources/reference.conf 
b/actor/src/main/resources/reference.conf
index fb2fc0a7d0..5474a38432 100644
--- a/actor/src/main/resources/reference.conf
+++ b/actor/src/main/resources/reference.conf
@@ -354,6 +354,10 @@ pekko {
         router = "round-robin-pool"
         nr-of-instances = 1
       }
+
+      "/IO-DNS/async-dns/*" {
+        dispatcher = ${pekko.io.dns.dispatcher}
+      }
     }
 
     default-dispatcher {
@@ -634,6 +638,7 @@ pekko {
         parallelism-min = 4
         parallelism-factor = 1.0
         parallelism-max = 64
+        minimum-runnable = -1
       }
     }
 
diff --git a/discovery/src/main/resources/reference.conf 
b/discovery/src/main/resources/reference.conf
index 05f1fc2ae9..aa6a29e5d7 100644
--- a/discovery/src/main/resources/reference.conf
+++ b/discovery/src/main/resources/reference.conf
@@ -10,6 +10,10 @@ pekko.actor.deployment {
     router = "round-robin-pool"
     nr-of-instances = 1
   }
+
+  "/SD-DNS/async-dns/*" {
+    dispatcher = ${pekko.io.dns.dispatcher}
+  }
 }
 
 pekko.discovery {
@@ -74,4 +78,3 @@ pekko.discovery {
     class = org.apache.pekko.discovery.dns.DnsServiceDiscovery
   }
 }
-


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to