[rabbitmq-discuss] rabbitmq_mnesia:wait_for_tables() - make timeout of 30 sec configurable?

Eugene Kirpichov ekirpichov at gmail.com
Thu Jun 30 15:07:52 BST 2011


I'm facing an issue where upon restart of a whole rabbitmq cluster, it
is sometimes the case that the current "main" node of the cluster (if
I'm understanding correctly, there exists a notion of leadership in a
RabbitMQ cluster?) takes longer to restart (e.g. the machine takes
longer to reboot) and all other nodes fail to start up with an error
like the one described below.

I looked into the source and found this:

wait_for_tables(TableNames) ->
    case mnesia:wait_for_tables(TableNames, 30000) of
        ok ->
        {timeout, BadTabs} ->
            throw({error, {timeout_waiting_for_tables, BadTabs}});
        {error, Reason} ->
            throw({error, {failed_waiting_for_tables, Reason}})

So, there's a hard-coded value of 30 seconds.

I propose to replace that line with:
WaitTimeout = case application:get_env(mnesia_wait_for_tables_timeout)
of {ok,T} -> t; _ -> 30000),
case mnesia:wait_for_tables(TableNames, WaitTimeout) of ...

Is my understanding of what's going on right? Does it make sense to
make this setting configurable in this way?

=ERROR REPORT==== 30-Jun-2011::06:01:28 ===
Reason: {error,
Stacktrace: [{rabbit_mnesia,wait_for_tables,1},

=INFO REPORT==== 30-Jun-2011::06:01:29 ===
    application: rabbit
    exited: {bad_return,{{rabbit,start,[normal,[]]},
    type: permanent

Eugene Kirpichov
Principal Engineer, Mirantis Inc. http://www.mirantis.com/
Editor, http://fprog.ru/

More information about the rabbitmq-discuss mailing list