'bad_vertex' errors while developing and testing RabbitMQ plugins

Today I have been doing maintenance work on an old RabbitMQ plugin of mine. Part of this work was updating its Makefiles to work with the latest RabbitMQ build system.

The problem and symptom

After getting it to compile, and trying to run it, I started seeing errors like this:

Error: {'EXIT',
          {{badmatch,
               {error,
                   {edge,{bad_vertex,mochiweb},rabbitmq_mochiweb,mochiweb}}},
           [{rabbit_plugins,dependencies,3,
                [{file,"src/rabbit_plugins.erl"},{line,100}]},
            {rabbit_plugins_main,format_plugins,4,
                [{file,"src/rabbit_plugins_main.erl"},{line,184}]},
            {rabbit_plugins_main,start,0,
                [{file,"src/rabbit_plugins_main.erl"},{line,70}]},
            {init,start_it,1,[]},
            {init,start_em,1,[]}]}}

Not just from rabbitmq-plugins, but also a similar error when starting the RabbitMQ server itself.

The reason turned out to be simple: I had symbolically linked the rabbitmq-mochiweb and mochiweb-wrapper directories into my plugins directory, as per the manual, but what the manual didn’t say was that this works for all plugins except the -wrapper plugins (and the Erlang “client” plugin, rabbitmq-erlang-client a.k.a. amqp_client.ez).

The solution

Symlink all the plugins except the wrapper plugins and amqp_client.ez.

The wrapper plugin *.ez files and amqp_client.ez need to be present in the plugins directory itself. So instead of the instructions given, try the following steps:

mkdir -p rabbitmq-server/plugins
cd rabbitmq-server/plugins
ln -s ../../rabbitmq-mochiweb
cp rabbitmq-mochiweb/dist/mochiweb*ez .
cp rabbitmq-mochiweb/dist/webmachine*ez .
../scripts/rabbitmq-plugins enable rabbitmq_mochiweb

A working configuration for me has the following contents of the plugins directory:

total 816
-rw-r--r--   1 tonyg  staff  260123 Sep 17 18:36 mochiweb-2.3.1-rmq0.0.0-gitd541e9a.ez
lrwxr-xr-x   1 tonyg  staff      23 Sep 17 17:59 rabbitmq-mochiweb -> ../../rabbitmq-mochiweb
-rw-r--r--   1 tonyg  staff  149142 Sep 17 18:37 webmachine-1.9.1-rmq0.0.0-git52e62bc.ez
Comments (closed)
Simon MacMullen 22:46, 17 Sep 2012

Ah, thanks for the pointer. Will fix the docs.