[rabbitmq-discuss] .Net client: out of memory when garbage on the wire

Vadim Chekan kot.begemot at gmail.com
Tue Apr 24 23:52:18 BST 2012


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.

-- 


More information about the rabbitmq-discuss mailing list