-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Akka.Remote: ensure RemoteActorRef
are serialized with correct Address
when using multiple transports
#7393
Akka.Remote: ensure RemoteActorRef
are serialized with correct Address
when using multiple transports
#7393
Conversation
Need to ensure we use `RemoteActorRef` instead of `ActorSelection` in order to properly reproduce bug
var actor = await selection.ResolveOne(TimeSpan.FromSeconds(1)); | ||
|
||
// assert that the remote actor is using the correct transport | ||
Assert.Contains(scheme, actor.Path.Address.Protocol); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently fails here - the IActorRef
returned to the ResolveOne
method belongs to transport 1 rather than transport 2.
So I thought this might be the culprit akka.net/src/core/Akka.Remote/Transport/AkkaPduCodec.cs Lines 556 to 564 in 5e2bd0e
But no, that code correctly serializes the |
RemoteActorRef
are serialized with correct Address
when using multiple transportsRemoteActorRef
are serialized with correct Address
when using multiple transports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Detailed my changes - I believe we have fixed the issue (but we'll need to check the results of the full Akka.Remote and up test suite first to confirm)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made some minor formatting changes here - nothing substantial
@@ -1357,7 +1359,7 @@ private SerializedMessage SerializeMessage(object msg) | |||
{ | |||
throw new EndpointException("Internal error: No handle was present during serialization of outbound message."); | |||
} | |||
return MessageSerializer.Serialize(_system, _handle.LocalAddress, msg); | |||
return MessageSerializer.Serialize(_system, _transportInformation, msg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is part of the real fix - make sure we're always setting the current transport information to our transport before we perform outbound serialization. That way, any messages included inside the payloads get serialized onto the correct transport when we have multiple running.
if (oldInfo == null) | ||
Akka.Serialization.Serialization.CurrentTransportInformation = | ||
system.Provider.SerializationInformation; | ||
Akka.Serialization.Serialization.CurrentTransportInformation = transportInformation; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other part of the real fix - make sure we explicitly set the CurrentTransportInformation
to whatever was passed in by the EndpointReader
before we get going
Performance NumbersRunning on .NET 8
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Changes
Fixes #7378
Checklist
For significant changes, please ensure that the following have been completed (delete if not relevant):