From 2bea414566ffe26abdf7bd6c8dec96ed9f51c884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=99=8E=E9=B8=A3?= Date: Sun, 1 Nov 2026 16:33:39 +0800 Subject: [PATCH] Fix classic remoting seed addresses in BasicClusterConfigSpec #3741 Motivation: The cluster configuration regression uses Artery seed addresses even when the nightly build selects classic remoting, preventing either node from joining. Modification: Derive the seed protocol from the effective transport configuration, bind classic remoting to loopback, and assert member protocols and hosts. Result: Both nodes form the expected two-member Up cluster with either transport. Tests: - JDK 17: BasicClusterConfigSpec reproduced the timeout before the fix with -Dpekko.remote.artery.enabled=off. - JDK 17: BasicClusterConfigSpec and BasicClusterManualSpec passed with classic remoting and default Artery, 3 tests per run. - Native scalafmt, headerCreateAll, checkCodeStyle (including +headerCheckAll), and git diff --check passed. - validatePullRequest encountered an ARM macOS LevelDB JNI architecture mismatch in persistence-typed; remaining validation is in progress. References: Fixes #3741 --- .../pekko/cluster/typed/BasicClusterExampleSpec.scala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cluster-typed/src/test/scala/docs/org/apache/pekko/cluster/typed/BasicClusterExampleSpec.scala b/cluster-typed/src/test/scala/docs/org/apache/pekko/cluster/typed/BasicClusterExampleSpec.scala index 4450177cff..1fa1c00338 100644 --- a/cluster-typed/src/test/scala/docs/org/apache/pekko/cluster/typed/BasicClusterExampleSpec.scala +++ b/cluster-typed/src/test/scala/docs/org/apache/pekko/cluster/typed/BasicClusterExampleSpec.scala @@ -132,11 +132,15 @@ class BasicClusterConfigSpec extends AnyWordSpec with ScalaFutures with Eventual val sys1Port = addresses.head.getPort val sys2Port = addresses.last.getPort sys1Port should not be sys2Port + val arteryEnabled = + configSystem1.withFallback(ConfigFactory.defaultReference()).getBoolean("pekko.remote.artery.enabled") + val protocol = if (arteryEnabled) "pekko" else "pekko.tcp" def config(port: Int) = ConfigFactory.parseString(s""" + pekko.remote.classic.netty.tcp.hostname = "127.0.0.1" pekko.remote.classic.netty.tcp.port = $port pekko.remote.artery.canonical.port = $port pekko.cluster.jmx.multi-mbeans-in-same-jvm = on - pekko.cluster.seed-nodes = [ "pekko://ClusterSystem@127.0.0.1:$sys1Port", "pekko://ClusterSystem@127.0.0.1:$sys2Port" ] + pekko.cluster.seed-nodes = [ "$protocol://ClusterSystem@127.0.0.1:$sys1Port", "$protocol://ClusterSystem@127.0.0.1:$sys2Port" ] """) val system1 = @@ -149,6 +153,8 @@ class BasicClusterConfigSpec extends AnyWordSpec with ScalaFutures with Eventual clusters.foreach { cluster => cluster.state.members.size shouldBe 2 cluster.state.members.unsorted.map(_.status) shouldBe Set(MemberStatus.Up) + cluster.state.members.unsorted.map(_.address.protocol) shouldBe Set(protocol) + cluster.state.members.unsorted.map(_.address.host) shouldBe Set(Some("127.0.0.1")) cluster.state.members.unsorted.map(_.address.port.get) shouldBe Set(sys1Port, sys2Port) } }