Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions src/core/Akka.Remote/Endpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1481,8 +1481,17 @@ private bool WriteSend(EndpointManager.Send send)
send.Recipient, send.Recipient.Path, send.SenderOption ?? _system.DeadLetters);
}

var pdu = _codec.ConstructMessage(send.Recipient.LocalAddressToUse, send.Recipient,
SerializeMessage(send.Message), send.SenderOption, send.Seq, _lastAck);
ByteString pdu;
try
{
pdu = _codec.ConstructMessage(send.Recipient.LocalAddressToUse, send.Recipient,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrap all concerns related to outbound serialization in an additional try...catch - throw the inner exception inside a new SerializationException since the outer try...catch knows to log those without disassociating.

SerializeMessage(send.Message), send.SenderOption, send.Seq, _lastAck);
}
catch (Exception e) when (e is not SerializationException)
{
// resolves https://github.com/akkadotnet/akka.net/issues/7922
throw new SerializationException("Serializer failed with exception", e);
}

_remoteMetrics.LogPayloadBytes(send.Message, pdu.Length);

Expand Down Expand Up @@ -1518,14 +1527,6 @@ private bool WriteSend(EndpointManager.Send send)
LogPossiblyWrappedMessageType(send.Message));
return true;
}
catch (ArgumentException ex)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This additional catch is now redundant given the inner try...catch

{
_log.Error(
ex,
"Serializer threw ArgumentException for message type [{0}]. Transient association error (association remains live)",
LogPossiblyWrappedMessageType(send.Message));
return true;
}
catch (EndpointException ex)
{
PublishAndThrow(ex, LogLevel.ErrorLevel);
Expand Down