Serialization and error queue filling issue

1,221 views
Skip to first unread message

Daniel D'Agostino

unread,
Mar 7, 2016, 10:05:10 AM3/7/16
to masstransit-discuss
Hi,

I am using Mass Transit with RabbitMQ, using binary serialization.

If I put a message containing "[]" in the queue via the RabbitMQ Management Plugin's Web UI, I get a bunch of errors starting as follows:

Rescuing exception
System.Runtime.Serialization.SerializationException: A JSON serialization exception occurred while deserializing the message envelope ---> Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'DynamicInternal08d34696f13053db34e6adddca520000.MassTransit.Serialization.MessageEnvelope' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.

I understand from the error message that the serializer is not expecting a JSON array, but two things are strange here:

1. Why am I getting a JSON serialization error when in fact I'm using binary serialization?
2. The error recurs continuously on the consumer and the error queue keeps growing with error messages; shouldn't it stop after a few retries?

Chris Patterson

unread,
Mar 7, 2016, 10:13:39 AM3/7/16
to masstrans...@googlegroups.com
Do the messages inside the error queue (visible from the RabbitMQ management plug-in) look binary? Is the Content-Type in the RabbitMQ showing that it is indeed a binary message content type? (application/vnd.masstransit+binary)

I'm not sure why it would use the JSON deserializer when the message is binary, that doesn't make sense to me. Are you using a feature of MassTransit that is not compatible with binary message bodies? (Quartz, Routing Slips, etc.)


--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/16130b7e-3aa5-4cda-9bb3-ed4fd073283c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniel D'Agostino

unread,
Mar 7, 2016, 10:25:50 AM3/7/16
to masstransit-discuss
No, no, I literally just put "[]" as a payload and set nothing else from RabbitMQ Management plugin (example attached). It's technically a poison message. I just don't think Mass Transit should be reacting this way.

Thanks,

Daniel



On Monday, 7 March 2016 16:13:39 UTC+1, Chris Patterson wrote:
Do the messages inside the error queue (visible from the RabbitMQ management plug-in) look binary? Is the Content-Type in the RabbitMQ showing that it is indeed a binary message content type? (application/vnd.masstransit+binary)

I'm not sure why it would use the JSON deserializer when the message is binary, that doesn't make sense to me. Are you using a feature of MassTransit that is not compatible with binary message bodies? (Quartz, Routing Slips, etc.)

On Mon, Mar 7, 2016 at 7:05 AM, Daniel D'Agostino <dan...@gmail.com> wrote:
Hi,

I am using Mass Transit with RabbitMQ, using binary serialization.

If I put a message containing "[]" in the queue via the RabbitMQ Management Plugin's Web UI, I get a bunch of errors starting as follows:

Rescuing exception
System.Runtime.Serialization.SerializationException: A JSON serialization exception occurred while deserializing the message envelope ---> Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'DynamicInternal08d34696f13053db34e6adddca520000.MassTransit.Serialization.MessageEnvelope' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.

I understand from the error message that the serializer is not expecting a JSON array, but two things are strange here:

1. Why am I getting a JSON serialization error when in fact I'm using binary serialization?
2. The error recurs continuously on the consumer and the error queue keeps growing with error messages; shouldn't it stop after a few retries?

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
masstransit-poison.png

Dru Sellers

unread,
Mar 7, 2016, 11:36:28 AM3/7/16
to masstrans...@googlegroups.com
My guess is MT defaults to JSON when the headers aren't set?

On Mon, Mar 7, 2016 at 9:25 AM, Daniel D'Agostino <dan...@gmail.com> wrote:
No, no, I literally just put "[]" as a payload and set nothing else from RabbitMQ Management plugin (example attached). It's technically a poison message. I just don't think Mass Transit should be reacting this way.

Thanks,

Daniel



On Monday, 7 March 2016 16:13:39 UTC+1, Chris Patterson wrote:
Do the messages inside the error queue (visible from the RabbitMQ management plug-in) look binary? Is the Content-Type in the RabbitMQ showing that it is indeed a binary message content type? (application/vnd.masstransit+binary)

I'm not sure why it would use the JSON deserializer when the message is binary, that doesn't make sense to me. Are you using a feature of MassTransit that is not compatible with binary message bodies? (Quartz, Routing Slips, etc.)

On Mon, Mar 7, 2016 at 7:05 AM, Daniel D'Agostino <dan...@gmail.com> wrote:
Hi,

I am using Mass Transit with RabbitMQ, using binary serialization.

If I put a message containing "[]" in the queue via the RabbitMQ Management Plugin's Web UI, I get a bunch of errors starting as follows:

Rescuing exception
System.Runtime.Serialization.SerializationException: A JSON serialization exception occurred while deserializing the message envelope ---> Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'DynamicInternal08d34696f13053db34e6adddca520000.MassTransit.Serialization.MessageEnvelope' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.

I understand from the error message that the serializer is not expecting a JSON array, but two things are strange here:

1. Why am I getting a JSON serialization error when in fact I'm using binary serialization?
2. The error recurs continuously on the consumer and the error queue keeps growing with error messages; shouldn't it stop after a few retries?

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.

To post to this group, send email to masstrans...@googlegroups.com.

Chris Patterson

unread,
Mar 7, 2016, 11:40:35 AM3/7/16
to masstrans...@googlegroups.com
You're right, when no header, JSON is used by default.

Still, it shouldn't fail endlessly, it should move it to the error queue and continue with life.


Reply all
Reply to author
Forward
0 new messages