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

Akka: serialize-messages barfs on built-in Akka.Cluster / Akka.Remote types #3724

Closed
Aaronontheweb opened this issue Feb 26, 2019 · 2 comments

Comments

@Aaronontheweb
Copy link
Member

Version: Akka.NET v1.3.11
Issue:

When akka.actor.serialize-messages = on, built-in Akka.Cluster and (possibly) Akka.Remote get serialized with JSON.NET (the default object serializer) instead of their specific serializer registrations, and thus this exception gets thrown:

Cause: Newtonsoft.Json.JsonSerializationException: Unable to find a constructor to use for type Akka.Cluster.InternalClusterAction+PublishChanges. A class should either have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute. Path 'NewGossip', line 1, position 97.

Reproduction from @Dan-Albrecht: https://github.com/Dan-Albrecht/AkkaRepro

Suspect that the issue is that the underlying serialize-messages code isn't correctly looking up the customer serializer correctly.

@Aaronontheweb
Copy link
Member Author

You know what... The issue here might be that some of the internal messages we pass around, internally, inside the Gossip system aren't inherently serializable AND they aren't meant to be sent across the network either. In which case, we need to mark those messages with INoSerializationVerificationNeeded

Aaronontheweb added a commit to Aaronontheweb/akka.net that referenced this issue Feb 26, 2019
Aaronontheweb added a commit to Aaronontheweb/akka.net that referenced this issue Feb 26, 2019
Also, disabled serialization verification for internal `PublishChanges`
@Aaronontheweb Aaronontheweb modified the milestones: 1.3.12, 1.4.0 May 22, 2019
madmonkey pushed a commit to madmonkey/akka.net that referenced this issue Jul 12, 2019
)

close akkadotnet#3724 - provided JSON constructor for Member

disabled serialization verification for internal `PublishChanges`
Aaronontheweb added a commit to Aaronontheweb/akka.net that referenced this issue Jul 30, 2019
)

close akkadotnet#3724 - provided JSON constructor for Member

disabled serialization verification for internal `PublishChanges`
@ctrlaltdan
Copy link

Just thought I'd contribute another serialization bug using 1.4.4.

[14:17:25 ERR] Swallowing exception during message send
Newtonsoft.Json.JsonSerializationException: Unable to find a constructor to use for type Akka.Remote.Ack. A class should either have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute. Path 'Ack.CumulativeAck', line 1, position 145.
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues(JsonObjectContract contract, JsonProperty containerProperty, JsonReader reader, Type objectType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor`1 creator, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Akka.Serialization.NewtonSoftJsonSerializer.FromBinary(Byte[] bytes, Type type)
   at Akka.Serialization.Serialization.Deserialize(Byte[] bytes, Int32 serializerId, String manifest)
   at Akka.Actor.ActorCell.SerializeAndDeserializePayload(Object obj)
   at Akka.Actor.ActorCell.SerializeAndDeserialize(Envelope envelope)
   at Akka.Actor.ActorCell.SendMessage(Envelope message)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants