question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Loop on connecting to receiver - RabbitMQ connection failed

See original GitHub issue

Hello,

We just faced some strange problem. We configured rabbit with retry policy so after 5 tries it should abandon. We are using rabbitMq transport (default one). When application and bus is starting and rabbitMq is not running (you can simply stop service for testing purpose) it just keeps trying to connect (we had 300 mb of logs with information that mass transit is unable to connect to queue with message RabbitMQ connection failed: Connect failed: guest@localhost:5672/).

Is there any place where we can configure retry policy when trying to connect? Because i understand that receive endpoint configuration with retry policy simply sets retry policy when trying to receive message not when trying to connect. Am i right?

BusControl = Bus.Factory.CreateUsingRabbitMq(x =>
{
    var host = x.Host(new Uri(_configuration.QueueAddress), h =>
    {
        h.Username(_configuration.UserName);
        h.Password(_configuration.Password);
    });

    x.ReceiveEndpoint(host, "Test",
        e =>
        {
            e.Instance(new TestConsumer(this));
            e.UseRetry(Retry.Exponential(5, TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(100),
                TimeSpan.FromSeconds(6)));
        });
});
BusControl.Start();

The loop occurs in PipeRetryExtensions RetryUntilCancelled which is called in Receiver method in RabbitMqReceiveTransport (https://github.com/MassTransit/MassTransit/blob/625c2afb4130bc7c24238d0480adb6845234acf9/src/MassTransit.RabbitMqTransport/Transport/RabbitMqReceiveTransport.cs#L101)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
phatboygcommented, Jan 3, 2017

So I tested this and my console app exited with a could not connect error after less than a minute. So the old version is likely the culprit.

0reactions
pawepawcommented, Jan 3, 2017

ok just rechecked and it seems that in 3.5.2 it does not occur. Thanks and sorry for bothering.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RabbitMQ infinite loop issue - spring boot
The cause is that the message is put back in the queue on exception. To fix it, you would not throw an exception...
Read more >
Connections
A connection can fail or be unable to satisfy a client operation. Such scenarios are called errors or protocol exceptions. They can indicate...
Read more >
13 Common RabbitMQ Mistakes and How to Avoid Them
Try to keep the connection/channel count low. Use separate connections to publish and consume. Ideally, you should have one connection per ...
Read more >
RabbitMQ resets the connection and messages are resent ...
This knowledge article addresses the scenario where on load RabbitMQ resets the connection with the inbound endpoint therefore causing messages to be sent ......
Read more >
Endless error loop of rabbitmq connection issue - Docs
The error ouptup shows that the document server is still trying to connect to the IP of 127.0.0.1. image. “[ERROR] [localhost] [docId] [userId] ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found