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

Newtonsoft.Json.Linq.JObject is not serialized/deserialized correctly #62

Open
branimirangelov opened this issue Oct 19, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@branimirangelov
Copy link
Collaborator

Send large object before the previous is handled by the listening stream leads to stalling.

@branimirangelov branimirangelov added the bug Something isn't working label Oct 19, 2020
@branimirangelov branimirangelov added this to the Release 0.6 milestone Oct 19, 2020
@branimirangelov
Copy link
Collaborator Author

branimirangelov commented Oct 19, 2020

@VikVelev - could you please comment when you have the code committed

@bojidar-bg
Copy link
Collaborator

bojidar-bg commented Oct 20, 2020

Debugged the issue using the sample code, it was reproducible under both 0.4.x and 0.5.1.
It turned out to be a problem while deserializing an element of a Newtonsoft.Json.Linq.JArray, likely a Newtonsoft.Json.Linq.JObject. From there, it seems like Ignite tried to deserialize JPropertyKeyedCollection.Comparer, a private readonly static property.

Sample stack trace:
System.Runtime.Serialization.SerializationException: The constructor to deserialize an object of type 'System.OrdinalCaseSensitiveComparer' was not found.                                                                                                                                                    
   at Apache.Ignite.Core.Impl.Common.SerializableTypeDescriptor.get_SerializationCtorUninitialized()
   at Apache.Ignite.Core.Impl.Binary.SerializableSerializer.ReadBinary[T](BinaryReader reader, IBinaryTypeDescriptor desc, Int32 
   at Apache.Ignite.Core.Impl.Binary.BinaryReader.ReadFullObject[T](Int32 pos, Type typeOverride)
   at Apache.Ignite.Core.Impl.Binary.BinaryReader.TryDeserialize[T](T& res, Type typeOverride)
   at Apache.Ignite.Core.Impl.Binary.BinaryReader.Deserialize[T](Type typeOverride)
   at Apache.Ignite.Core.Impl.Binary.BinaryReader.ReadObject[T](String fieldName)
   at Apache.Ignite.Core.Impl.Binary.SerializableSerializer.ReadSerializationInfo(BinaryReader reader, IEnumerable`1 fieldNames, Type type, ICollection`1 dotNetFields)                                                                                                                                                                                         
   at Apache.Ignite.Core.Impl.Binary.SerializableSerializer.ReadBinary[T](BinaryReader reader, IBinaryTypeDescriptor desc, Int32 pos, Type typeOverride)
[.. recursive ..]
   at Apache.Ignite.Core.Impl.Binary.BinaryReader.ReadFullObject[T](Int32 pos, Type typeOverride)
   at Apache.Ignite.Core.Impl.Binary.BinaryReader.TryDeserialize[T](T& res, Type typeOverride)
   at Apache.Ignite.Core.Impl.Binary.BinaryReader.Deserialize[T](Type typeOverride)
   at Apache.Ignite.Core.Impl.Binary.BinaryReader.ReadObject[T](String fieldName)
   at lambda_method(Closure , Object , IBinaryReader )
   at Apache.Ignite.Core.Impl.Binary.BinaryReflectiveSerializerInternal.Apache.Ignite.Core.Impl.Binary.IBinarySerializerInternal.ReadBinary[T](BinaryReader reader, IBinaryTypeDescriptor desc, Int32 pos, Type typeOverride)
[.. /recursive ..]
   at Apache.Ignite.Core.Impl.Binary.BinaryReader.ReadFullObject[T](Int32 pos, Type typeOverride)
   at Apache.Ignite.Core.Impl.Binary.BinaryReader.TryDeserialize[T](T& res, Type typeOverride)
   at Apache.Ignite.Core.Impl.Binary.BinaryReader.Deserialize[T](Type typeOverride)
   at Apache.Ignite.Core.Impl.Binary.BinaryReader.ReadBinaryObject[T](Boolean doDetach)
   at Apache.Ignite.Core.Impl.Binary.BinaryReader.TryDeserialize[T](T& res, Type typeOverride)
   at Apache.Ignite.Core.Impl.Binary.BinaryReader.Deserialize[T](Type typeOverride)
   at Apache.Ignite.Core.Impl.Binary.Marshaller.Unmarshal[T](IBinaryStream stream, BinaryMode mode, BinaryObjectBuilder builder)
   at Apache.Ignite.Core.Impl.Binary.Marshaller.Unmarshal[T](IBinaryStream stream, Boolean keepBinary)
   at Apache.Ignite.Core.Impl.Client.Cache.CacheClient`2.UnmarshalNotNull[T](ClientResponseContext ctx)
   at Apache.Ignite.Core.Impl.Client.Cache.CacheClient`2.<GetAsync>b__2(ClientResponseContext ctx)
   at Apache.Ignite.Core.Impl.Client.ClientSocket.DecodeResponse[T](BinaryHeapStream stream, Func`2 readFunc, Func`3 errorFunc)
   at Apache.Ignite.Core.Impl.Client.ClientSocket.<>c__DisplayClass1`1.<DoOutInOpAsync>b__0(Task`1 responseTask)
[.. task dispatcher ..]
   at Perper.WebJobs.Extensions.Services.PerperFabricContext.WriteNotificationToChannel(Notification notification, String streamName, String parameterName) in /home/bobo/Projects/obecto/perper/functions/runtime/src/Perper.WebJobs.Extensions/Services/PerperFabricContext.cs:line 282
   at Perper.WebJobs.Extensions.Services.PerperFabricContext.RouteNotification(Notification notification) in /home/bobo/Projects/obecto/perper/functions/runtime/src/Perper.WebJobs.Extensions/Services/PerperFabricContext.cs:line 259
   at Perper.WebJobs.Extensions.Services.PerperFabricContext.<>c__DisplayClass9_1.<<StartListen>b__3>d.MoveNext() in /home/bobo/Projects/obecto/perper/functions/runtime/src/Perper.WebJobs.Extensions/Services/PerperFabricContext.cs:line 123

Added some logging in 0.5.2 (e33f9ce), and made sure that a deserialization failure does not cause a complete stop of message processing, which should help debug and handle instances of similar issues in the future.

As Newtonsoft.Json support is not blocking for 0.6, the milestone could be removed. A valid workaround for the time being is passing the value as a JSON-encoded String.

@bojidar-bg bojidar-bg changed the title For verification: Large objects lead to stall in streams Newtonsoft.Json.Linq.JObject is not serialized/deserialized correctly Oct 20, 2020
@bojidar-bg bojidar-bg removed this from the Release 0.6 milestone Oct 20, 2020
@bojidar-bg bojidar-bg removed their assignment Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants