[rabbitmq-discuss] WCF bindings connection drop outs

LuCo lucooo at gmail.com
Fri Jan 13 10:27:34 GMT 2012


Hi there.

I am using the RabbitMQ.ServiceModel WCF bindings with a .Net client
talking to a standard WCF service (two way) and am having a problem
with a long running connection which seems to stop responding after a
long period of time (vague, but it happens without fail if I leave the
client open overnight) only when I next try to use the WCF client
channel.

On the server, the WCF service runs ok and I can confirm in the
RabbitMQ Management plugin that the queue has been created for this
service (I might add I slightly modified the RabbitMQ WCF source to
use durable queues for the service).

On the client, I create a WCF channel from a ChannelFactory<T> and
maintain a single instance of these objects during the lifetime of the
client (ignoring potential channel faulting for now to keep things
simple). Once I use the channel to call the service (successfully) I
can confirm in the RabbitMQ Management plugin that the client has a
queue created on the broker and messages are flowing between the
client and service.

If I leave the client overnight, the next time I attempt to use the
channel to call the service I receive an IOException at the following
point in the stack:

"Unable to read data from the transport connection: An existing
connection was forcibly closed by the remote host."

   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32
offset, Int32 size)
   at System.IO.BufferedStream.ReadByte()
   at System.IO.BinaryReader.ReadByte()
   at RabbitMQ.Client.Impl.Frame.ReadFrom(NetworkBinaryReader reader)

InnerException: SocketException (SocketErrorCode = ConnectionReset)

I have observed the following in trying to work out what is going on
here:
(1) Prior to the exception above, the RabbitMQ Management plugin shows
the client queue at a port number I can confirm is ESTABLISHED via a
netstat on the client

(2) After the exception above, a netstat on the client reveals the
port has been removed from the list, however, the RabbitMQ Management
plugin still shows the client queue at the old port number and does
not update. I have enabled tracing on the broker and no messages are
exchanged when the exception is raised, nor have been since the last
successful message (previous day).

(3) Attempting to use the channel after the exception (again, without
creating a new channel) results in the below exception:
"The AMQP operation was interrupted: AMQP close-reason, initiated by
Library, code=541, text="Unexpected Exception", classId=0, methodId=0,
cause=System.IO.IOException: Unable to read data from the transport
connection: An existing connection was forcibly closed by the remote
host. ---> System.Net.Sockets.SocketException: An existing connection
was forcibly closed by the remote host
   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset,
Int32 size, SocketFlags socketFlags)
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32
offset, Int32 size)
   --- End of inner exception stack trace ---
   at RabbitMQ.Client.Impl.Frame.ReadFrom(NetworkBinaryReader reader)
in C:\rabbitmq-dotnet-client-2.7.0\projects\client\RabbitMQ.Client\src
\client\impl\Frame.cs:line 103
   at RabbitMQ.Client.Impl.SocketFrameHandler_0_9.ReadFrame() in C:
\rabbitmq-dotnet-client-2.7.0\projects\client\RabbitMQ.Client\src
\client\impl\SocketFrameHandler_0_9.cs:line 136
   at RabbitMQ.Client.Impl.ConnectionBase.MainLoopIteration() in C:
\rabbitmq-dotnet-client-2.7.0\projects\client\RabbitMQ.Client\src
\client\impl\ConnectionBase.cs:line 632
   at RabbitMQ.Client.Impl.ConnectionBase.MainLoop() in C:\rabbitmq-
dotnet-client-2.7.0\projects\client\RabbitMQ.Client\src\client\impl
\ConnectionBase.cs:line 582"

(4) I can create a new client channel without any issues and
successfully send messages to the service. However, whilst this solves
the issue on the client, I end up with ghost queues on the broker that
just hang around uselessly.

(5) I can switch the WCF bindings to TCP (eliminating RabbitMQ from
the equation) and I do not see the above problem.

Any thoughts? Am I not using the RabbitMQ WCF bindings as I should be?
Do I need to modify the RabbitMQ.ServiceModel source to toggle timeout
settings?

Thanks. Daniel


More information about the rabbitmq-discuss mailing list