MassTransit: Channel is closing when hitting consumer_timeout (RabbitMQ)

Contact Details

ellepitre@sherweb.com

Version

8.x

On which operating system(s) are you experiencing the issue?

Linux

Using which broker(s) did you encounter the issue?

RabbitMQ

What are the steps required to reproduce the issue?

1. Set a short consumer_timeout value in the broker
2. Consume a message for a longer period of time than the consumer_timeout

What is the expected behavior?

  • The timeout should be triggered and an exception should be raise.
  • If the broker closes the channel, MT should reconnect to the channel.

What actually happened?

  • The timeout is triggered and an exception is raised.
  • The channel closes and the consumer stops consuming messages.
  • The connection to the broker appears to be healthy.

Related log output, including any exceptions

{
	"content": {
		"timestamp": "2023-03-28T14:02:24.294Z",
		"message": "The channel was closed: AMQP close-reason, initiated by Peer, code=406, text='PRECONDITION_FAILED - delivery acknowledgement on channel 2 timed out. Timeout value used: 1800000 ms. This timeout value can be configured, see consumers doc guide to learn more', classId=0, methodId=0 2",
		"attributes": {
			"date": "2023-03-28T14:02:24.294",
			"exception": {
				"Message": "The channel was closed: AMQP close-reason, initiated by Peer, code=406, text='PRECONDITION_FAILED - delivery acknowledgement on channel 2 timed out. Timeout value used: 1800000 ms. This timeout value can be configured, see consumers doc guide to learn more', classId=0, methodId=0 2",
				"HResult": -2146233088,
				"Problem": {
					"Status": 500,
					"Type": "System.InvalidOperationException",
					"Instance": "",
					"Title": "The channel was closed: AMQP close-reason, initiated by Peer, code=406, text='PRECONDITION_FAILED - delivery acknowledgement on channel 2 timed out. Timeout value used: 1800000 ms. This timeout value can be configured, see consumers doc guide to learn more', classId=0, methodId=0 2",
					"Detail": "   at MassTransit.RabbitMqTransport.RabbitMqReceiveLockContext.Complete() in /_/src/Transports/MassTransit.RabbitMqTransport/RabbitMqTransport/RabbitMqReceiveLockContext.cs:line 30"
				}
			},
			"level": "ERROR"
		}
	}
}
{
	"content": {
		"message": "T-FAULT .... 01000000-54c3-eec2-256d-08db2f94dffa",
		"attributes": {
			"date": "2023-03-28T14:02:24.294",
			"exception": {
				"Type": "MassTransit.TransportUnavailableException",
				"Message": "Message ACK failed: 62744",
				"StackTrace": "   at MassTransit.RabbitMqTransport.RabbitMqReceiveLockContext.Complete() in /_/src/Transports/MassTransit.RabbitMqTransport/RabbitMqTransport/RabbitMqReceiveLockContext.cs:line 30\n   at MassTransit.Transports.ReceivePipeDispatcher.Dispatch(ReceiveContext context, ReceiveLockContext receiveLock) in /_/src/MassTransit/Transports/ReceivePipeDispatcher.cs:line 105\n   at MassTransit.Transports.ReceivePipeDispatcher.Dispatch(ReceiveContext context, ReceiveLockContext receiveLock) in /_/src/MassTransit/Transports/ReceivePipeDispatcher.cs:line 105\n   at MassTransit.Transports.ReceivePipeDispatcher.Dispatch(ReceiveContext context, ReceiveLockContext receiveLock) in /_/src/MassTransit/Transports/ReceivePipeDispatcher.cs:line 105\n   at MassTransit.RabbitMqTransport.RabbitMqBasicConsumer.<>c__DisplayClass24_0.<<HandleBasicDeliver>b__0>d.MoveNext() in /_/src/Transports/MassTransit.RabbitMqTransport/RabbitMqTransport/RabbitMqBasicConsumer.cs:line 216",
				"HResult": -2146233088,
				"InnerException": {
					"Type": "System.InvalidOperationException",
					"Message": "The channel was closed: AMQP close-reason, initiated by Peer, code=406, text='PRECONDITION_FAILED - delivery acknowledgement on channel 2 timed out. Timeout value used: 1800000 ms. This timeout value can be configured, see consumers doc guide to learn more', classId=0, methodId=0 2",
					"StackTrace": "   at MassTransit.RabbitMqTransport.RabbitMqReceiveLockContext.Complete() in /_/src/Transports/MassTransit.RabbitMqTransport/RabbitMqTransport/RabbitMqReceiveLockContext.cs:line 30",
					"HResult": -2146233079,
					"TargetSite": "Void Throw()",
					"Source": "System.Private.CoreLib"
				},
				"TargetSite": "Void MoveNext()",
				"Source": "MassTransit.RabbitMqTransport"
			},
			"level": "ERROR",
			"logger": "MassTransit.ReceiveTransport"
		}
	}
}

Link to repository that demonstrates/reproduces the issue

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 17 (9 by maintainers)

Commits related to this issue

Most upvoted comments

There were major changes in how endpoints start/stop to be built around a consistent underlying component (ConsumerAgent) that were released with 8.0.14, and the sample test harness I linked above I believe is using the current version (it uses project references, to have the full codebase).

image

I don’t see any channel growth after several recycles of the endpoint.