Skip to content

Exception when disabling heartbeat with v7 #1756

@Socolin

Description

@Socolin

Describe the bug

Looks like ConnectionFactory.RequestedHeartbeat no longer accept Timespan.Zero as documented

        /// <summary>
        /// Default value for desired heartbeat interval. Default is 60 seconds,
        /// TimeSpan.Zero means "heartbeats are disabled".
        /// </summary>
RabbitMQ.Client.Exceptions.BrokerUnreachableException : None of the specified endpoints were reachable
  ----> System.AggregateException : One or more errors occurred. (Timeout can be only be set to 'System.Threading.Timeout.Infinite' or a value > 0. (Parameter 'value'))
  ----> System.ArgumentOutOfRangeException : Timeout can be only be set to 'System.Threading.Timeout.Infinite' or a value > 0. (Parameter 'value')
   at RabbitMQ.Client.ConnectionFactory.CreateConnectionAsync(IEndpointResolver endpointResolver, String clientProvidedName, CancellationToken cancellationToken)

Crash in ConfigureFrameHandler this line

 fh.ReadTimeout = RequestedHeartbeat;

Reproduction steps

var connectionFactory = new ConnectionFactory
{
	Uri = uri,
	AutomaticRecoveryEnabled = true,
	RequestedHeartbeat = TimeSpan.Zero,
};

_connection = await connectionFactory.CreateConnectionAsync("some-name");

Expected behavior

Should not crash, or crash with a clear error message if this is not valid anymore.

Additional context

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions