pjfanning opened a new pull request, #3652:
URL: https://github.com/apache/pekko/pull/3652

   ### Motivation
   Two actor systems with the same uid break Artery associations: the uid 
collision surfaced as an unexpected
   `IllegalArgumentException` during the handshake, a `HandshakeRsp` was still 
sent, and the association was left in a
   confusing state. The uid itself was a plain random Long chosen when the 
ActorSystem is created, so collisions were
   not as unlikely as they could be.
   
   ### Modification
   - Artery: `AssociationRegistry.setUID` throws a dedicated internal 
`UidCollisionException`. `ArteryTransport.completeHandshake`
     catches it, logs a warning, quarantines the colliding peer uid and fails 
the handshake. `InboundHandshake` only sends
     `HandshakeRsp` when completing the handshake succeeded.
   - System uid: new internal `systemUid` on `ActorRefProvider` and 
`RemoteTransport`. `ExtendedActorSystem.uid` delegates
     to the provider (and throws `IllegalStateException` if read before the 
provider is initialized).
     `LocalActorRefProvider` and classic `Remoting` keep a random uid; 
`ArteryTransport` generates it at start from the
     bind host, port and several timestamps.
   - Internal `pekko.test-only-uid` setting (not in reference.conf) to force a 
uid in tests.
   - `Slf4jLogger` resolves the uid lazily and omits the `pekkoUid` MDC value 
until it is available.
   - Tests: uid collision tests in `RemoteConnectionSpec` (connections TO and 
FROM two systems sharing a uid), new `SystemUidSpec`.
   
   ### Result
   Uid collisions no longer break existing associations; the colliding peer is 
rejected cleanly. Artery uids are much
   less likely to collide.
   
   ### Tests
   - Not run locally - left to CI
   
   ### References
   Ported from (Apache-2.0 since 2026-10-23):
   - https://github.com/akka/akka-core/pull/32161
   - https://github.com/akka/akka-core/pull/32168
   
   ### Notes for reviewers
   - Wire format unchanged: the uid is still a Long, so 2.0.0 and newer nodes 
interoperate in a rolling upgrade.
   - MiMa excludes (`ReversedMissingMethodProblem`) in `actor/` and `remote/` 
`2.0.x.backwards.excludes/system-uid.excludes`
     for the new abstract `systemUid` on the @DoNotInherit `ActorRefProvider` 
and the internal `RemoteTransport`.
   - Init ordering: `system.uid` now throws if read before the remote transport 
has started. Callers checked:
     `AddressUidExtension`, cluster, `RemoteWatcher`, the receptionist (all 
after `transport.start()`); `Slf4jLogger`
     handles the early case.
   - The collision is logged with `log.warning(exc.getMessage)`; the ported 
tests use
     `EventFilter[UidCollisionException]().intercept`, so check CI for that 
expectation.
   - Classic remoting behaviour is unchanged (random uid).
   


-- 
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]

Reply via email to