pjfanning opened a new pull request, #3551: URL: https://github.com/apache/pekko/pull/3551
### Motivation `RemotingSpec` "allow other system to connect even if it's not there at first" still fails intermittently in CI with `java.net.BindException: Address already in use` when the port from `temporaryServerAddress()` is taken before the new `ActorSystem` binds (seen again on #3549, `Check / Tests (scala213)`). The retry in `selectionAndBind` only fires when the exception message contains `"Failed to bind"`, but classic Netty remoting rethrows the raw `BindException` from `Remoting.start`, so the guard never matched and the retry added in #3015 was effectively dead code on this path. That string only exists in the Artery TCP transport. ### Modification - Add an `isBindFailure` helper that walks the cause chain and matches on `java.net.BindException` (keeping the `"Failed to bind"` message check for other transports), and use it as the retry guard in `selectionAndBind`. - Add a directional test that starts an `ActorSystem` on a port already held by a `ServerSocket` and asserts the thrown exception is recognized by `isBindFailure` (and that an unrelated exception is not). The old string guard returns `false` for this exception. ### Result The lazy-connect tests retry on a fresh port when the temporary port is already in use instead of failing the suite. ### Tests - `scalafmt remote/src/test/scala/org/apache/pekko/remote/classic/RemotingSpec.scala` - `sbt "remote/testOnly org.apache.pekko.remote.classic.RemotingSpec"` — 23 tests, all passing (includes the new test) - `git diff --check` ### References Refs #1679, Refs #3015 - port race in RemotingSpec lazy-connect tests -- 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]
