[rabbitmq-discuss] WCF bindings connection drop outs

LuCo lucooo at gmail.com
Tue Jan 24 16:48:44 GMT 2012


>>The heartbeat does solve the connection drop outs thanks. I added this to the RabbitMQTransportBindingElement as you suggested.
>>
>>Related, but not causing a noticeable issue is a message in a RabbitMQ trace that I was using to investigate drop outs that is:
>>
>>"Due to a user abort the reliable session cannot continue" (wrapped in a message on the client queue)
>>
>>This message is sent to the client queue after periods of inactivity. I understand what this message means and have played around with the timeout >>settings (receive,inactivity) on the RabbitMQ WCF binding to no avail. This message is always raised even though keep alive messages (ack >>requests/acknowledgements) are exchanged between client and server queues at a frequency that matches timeout settings (or half of in the case of >>the inactivity timeout) as seen in the trace.
>>
>>As I said, there is no noticeable affect on sending/receiving messages but am curious why the message appears in the trace at all?
>>

>What is the period of inactivity that precedes the error? If it is 10 minutes then you may need to adjust "Inactivity Timeout". If you have already tried >that can you show how you changed the binding or the config file?

The actual problem is the ReceiveTimeout. If the period of inactivity
exceeds the ReceiveTimeout on the service, the message below is sent
to the client queue:

Node:         rabbit at MACHINE2
Exchange:     amq.direct
Routing keys: [<<"/439a2420-2369-4d00-8e23-704b4d31dda1">>]
Properties:   []
Payload:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><a:Action
s:mustUnderstand="1">http://www.w3.org/2005/08/addressing/soap/fault</
a:Action><a:To s:mustUnderstand="1">soap.amqp:///
439a2420-2369-4d00-8e23-704b4d31dda1</a:To></
s:Header><s:Body><s:Fault><s:Code><s:Value>s:Receiver</
s:Value><s:Subcode><s:Value xmlns:a="http://schemas.xmlsoap.org/ws/
2005/02/rm">a:SequenceTerminated</s:Value></s:Subcode></
s:Code><s:Reason><s:Text xml:lang="en-GB">Due to a user abort the
reliable session cannot continue.</s:Text></
s:Reason><s:Detail><r:Identifier xmlns:r="http://schemas.xmlsoap.org/
ws/2005/02/rm">urn:uuid:e4415296-97ff-4b1a-9b3c-e43b862037ca</
r:Identifier></s:Detail></s:Fault></s:Body></s:Envelope>

I have added to the
RabbitMQ.ServiceModel.RabbitMQBindingConfigurationElement class (I can
send you the code if you wish) ...

[ConfigurationProperty("inactivityTimeout", DefaultValue="00:10:00")]
public TimeSpan InactivityTimeout ... (etc.)
[ConfigurationProperty("receiveTimeout", DefaultValue = "00:10:00")]
public new TimeSpan ReceiveTimeout ... (etc.)

... to capture configured values. The OnApplyConfiguration method in
the above class will then use values from the above properties to set
the relevant properties on the RabbitMQ.ServiceModel.RabbitMQBinding
class (InitializeFrom also modified to set on 'binding' parameter). By
setting the InactivityTimeout I am effectively getting infrastructure
ack messages sent to the client and server queues and I can see this
in the messages below (first message is to service queue, second
message is to client queue):

================================================================================
2012-1-24 14:6:0: Message published

Node:         rabbit at MACHINE2
Exchange:     amq.direct
Routing keys: [<<"/Service">>]
Properties:   []
Payload:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
xmlns:r="http://schemas.xmlsoap.org/ws/2005/02/rm" xmlns:a="http://
www.w3.org/2005/08/addressing"><s:Header><r:AckRequested><r:Identifier>urn:uuid:e4415296-97ff-4b1a-9b3c-e43b862037ca</r:Identifier></r:AckRequested><a:Action
s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2005/02/rm/
AckRequested</a:Action></s:Header><s:Body/></s:Envelope>

================================================================================
2012-1-24 14:6:0: Message published

Node:         rabbit at MACHINE2
Exchange:     amq.direct
Routing keys: [<<"/439a2420-2369-4d00-8e23-704b4d31dda1">>]
Properties:   []
Payload:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
xmlns:r="http://schemas.xmlsoap.org/ws/2005/02/rm" xmlns:a="http://
www.w3.org/2005/08/addressing"><s:Header><r:SequenceAcknowledgement><r:Identifier>urn:uuid:e4415296-97ff-4b1a-9b3c-e43b862037ca</r:Identifier><r:AcknowledgementRange
Lower="1" Upper="2"/><netrm:BufferRemaining xmlns:netrm="http://
schemas.microsoft.com/ws/2006/05/rm">8</netrm:BufferRemaining></
r:SequenceAcknowledgement><a:Action s:mustUnderstand="1">http://
schemas.xmlsoap.org/ws/2005/02/rm/SequenceAcknowledgement</
a:Action><a:To s:mustUnderstand="1">soap.amqp:///
439a2420-2369-4d00-8e23-704b4d31dda1</a:To></s:Header><s:Body/></
s:Envelope>

For example, if I set the InactivityTimeout and ReceiveTimeout
properties to 2 minutes I am seeing an ack message sent at 1 minute
(after initial call - as expected as the infrastructure message is
fired every half of the inactivity value), but then at 2 minutes the
error message above is sent to the client queue (when the
receivetimeout expires). So even though messages are being exchanged,
the connection still aborts as it has not received any application
messages during this time.

After some Googling I came across this (http://msdn.microsoft.com/en-
us/library/system.servicemodel.channels.binding.receivetimeout.aspx)
which answers the question I believe. The ReceiveTimeout listens for
application messages, and if none are received within the duration
specified it will fault the channel. The InactivityTimeout listens for
application AND infrastructure messages. I think I will need to set
the ReceiveTimeout value on the service to a sufficiently large value
for real world scenarios (max is 24 days I think).

Anyway, I have added some new config fields to the binding
configuration (as described above) which should enable toggling of
these values to provide the best fit.

Daniel.




More information about the rabbitmq-discuss mailing list