Skip to content
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

Prevent EndpointDisassociatedException from being thrown from EndpointReader #5155

Conversation

Arkatufus
Copy link
Contributor

@Arkatufus Arkatufus commented Jul 26, 2021

Hyperion can throw an InvalidCastException when deserializing a message that came from a system that uses a different sorting order compared to the receiving system. This exception should be treated like a SerializationException and should not cause the EndpointReader to fail.

@@ -1961,6 +1961,10 @@ private void Reading()
{
LogTransientSerializationError(ackAndMessage.MessageOption, e);
}
catch (InvalidCastException e)
{
LogTransientSerializationError(ackAndMessage.MessageOption, e);
Copy link
Member

Choose a reason for hiding this comment

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

LGTM

@Aaronontheweb Aaronontheweb enabled auto-merge (squash) July 26, 2021 15:43
@Aaronontheweb Aaronontheweb added this to the 1.4.22 milestone Jul 26, 2021
@Aaronontheweb Aaronontheweb merged commit a4e26fb into akkadotnet:dev Jul 26, 2021
@zbynek001
Copy link
Contributor

just curious, isn't this already handled here?

throw new SerializationException($"Failed to deserialize instance of type {type}. {ex.Message}", ex);

@Aaronontheweb
Copy link
Member

just curious, isn't this already handled here?

throw new SerializationException($"Failed to deserialize instance of type {type}. {ex.Message}", ex);

Good question - cc @Arkatufus ?

@Arkatufus
Copy link
Contributor Author

Arkatufus commented Jul 28, 2021

No, that catches SerializationException, this is a specific failure that throws InvalidCastException inside Hyperion, most probably due to the incompatible sorting order between systems.
InvalidCastException isn't caught inside the EndpointReader, causing it to fail and die, which is quite bad.

@Aaronontheweb
Copy link
Member

But if you click into that gist, that SerializationException gets raised when any Exception is thrown via the HyperionSerializer - I think that was @zbynek001's observation

@Arkatufus
Copy link
Contributor Author

Yes, but the same problem will happen to people who doesn't use the latest Hyperion version, InvalidCastException will get bubbled up uncaught, so this is more of a backward compatibility patch

@Aaronontheweb
Copy link
Member

@Arkatufus that's a good point - we used to not catch those errors inside HyperionSerializer up until a month ago.

@Aaronontheweb
Copy link
Member

In fact, we probably haven't released a new version of Akka.NET since that bug fix was introduced. Meant to do that last week but ran out of time before I had to go on leave.

@Arkatufus Arkatufus deleted the Fix_Hyperion_causes_EndpointDissociatedException branch February 27, 2023 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants