Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry in case create_session gets error 500 #44

Merged
merged 3 commits into from
Aug 22, 2017

Conversation

Gsantomaggio
Copy link
Member

Fixes #42

When Consul is starting, the sockets are up, but the end points are not ready yet

Consul raises the following error when the plugin tries to create a session:

2017/08/22 08:55:02 [ERR] http: Request PUT /v1/session/create, error: No cluster leader from=127.0.0.1:58446

And the broker gets down:

=INFO REPORT==== 22-Aug-2017::08:47:36 ===
Error description:
   {could_not_start,rabbit,
       {{case_clause,"Error while creating a session, reason: \"500\""},
        [{autocluster,acquire_startup_lock,1,
             [{file,"src/autocluster.erl"},{line,212}]},
         {autocluster,run_steps,1,[{file,"src/autocluster.erl"},{line,131}]},

With this fix, in case the session creation raises Error 500 it retries to execute the create session.

To reproduce the issue:

  1. Run a clean RabbitMQ instance
  2. When is "Starting broker.." start a clean Consul instance

maybe_create_session(Who, N) when N > 0 ->
case create_session(Who, autocluster_config:get(consul_svc_ttl)) of
{error, "500"} ->
autocluster_log:warning("Error 500 while creating a session, " ++
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to nitpick but can we make it say "Consul session" to be clearer?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done !
( Had to google to understand the "nitpick" meaning :) )

Gabriele Santomaggio and others added 2 commits August 22, 2017 15:58
@michaelklishin michaelklishin merged commit 27ad2a1 into stable Aug 22, 2017
@dumbbell dumbbell deleted the rabbitmq-autocluster-42 branch January 2, 2018 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants