« Return to Thread: .Net client: out of memory when garbage on the wire

.Net client: out of memory when garbage on the wire

by vchekan :: Rate this Message:

| View in Thread

Hi all,
I'm investigating a case when in certain conditions .net client can kill server for ~15minutes.
We have a specific firewall setup and it can return an ascii string "uou do not have access to this service". Details do not matter, but in such case .net client will just kill the client box instantly. Even mouse wont move.

I've investigated it and found that the problem is in RabbitMQ.Client.Impl.Frams.cs:ReadFrom():
            int payloadSize = reader.ReadInt32(); // FIXME - throw exn on unreasonable value
In case if client attempts to connect to a socket which returns non-ampq message, it will attempt to allocate an array, of generally speaking random size.
Ampq-0.9.1 spec (paragraph 4.2.3  General Frame Format) says:
> If a peer receives a frame with a type that is not one of these defined types, it MUST treat this as a
fatal protocol error and close the connection without sending any further data on it

But I can not understand the logic of the code in Frame.ReadFrom:
http://hg.rabbitmq.com/rabbitmq-dotnet-client/file/0d3c7b59412e/projects/client/RabbitMQ.Client/src/client/impl/Frame.cs#l107
 if (type == 'A')
The local variable name which recieves the value is "type", but it checks for "AMQP" which should not be expected and it fail to check for type in 1-4 range which should be expected according to the spec. And it will keep reading "size" and "byte[size]" even though they can be a garbage.
Am I missing something?

Vadim.

--
From RFC 2631: In ASN.1, EXPLICIT tagging is implicit unless IMPLICIT is explicitly specified

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@...
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

 « Return to Thread: .Net client: out of memory when garbage on the wire