rabbitmq / rabbitmq-web-stomp

Provides support for STOMP over WebSockets
Other
89 stars 26 forks source link

Cannot re-enable rabbitmq_web_stomp plugin after disabling it #72

Closed kpe closed 7 years ago

kpe commented 7 years ago

Stopping the web_stomp plugin fails (while rabbitmq is running), e.g. doing

rabbitmq-plugins enable  rabbitmq_web_stomp
rabbitmq-plugins disable rabbitmq_web_stomp
rabbitmq-plugins enable  rabbitmq_web_stomp

fails with

Error: {could_not_start,rabbitmq_web_stomp,
       {{badmatch,{error,{already_started,<10343.424.0>}}},
        [{rabbit_ws_sockjs,init,0,
             [{file,"src/rabbit_ws_sockjs.erl"},{line,51}]},
         {rabbit_ws_app,start,2,
             [{file,"src/rabbit_ws_app.erl"},{line,26}]},
         {application_master,start_it_old,4,
             [{file,"application_master.erl"},{line,273}]}]}}

in similar fashion

rabbitmqctl stop_app
rabbitmqctl start_app

fails with the same "sockjs is aready started" error.

I'm not sure however if that's sockjs, webstomp or rabbitmq error. This was working with rabbitmq 3.6.3, but seems to be broken since 3.6.8 at least.

My rabbitmq.config looks like this:

[
 {ssl, [{versions, ['tlsv1.2','tlsv1.1']}]},
 {rabbit, [
           {vm_memory_high_watermark, {absolute, "4096MiB"}},
          {tcp_listeners, [5672]},
          {ssl_listeners, [5671]},
          {ssl_options, [{cacertfile, "/etc/rabbitmq/cacert.pem"},
                         {certfile,   "/etc/rabbitmq/cert.pem"},
                         {keyfile,    "/etc/rabbitmq/key.pem"},
                         {verify,verify_peer},
                         {fail_if_no_peer_cert,true},
                         {versions, ['tlsv1.2']}
                        ]},
          {loopback_users, []},
          {cluster_nodes, {[],disc}}
         ]
},
{rabbitmq_web_stomp,
 [{tcp_config, []},
  {ssl_config, [{port, 15691},
                {backlog, 1024},
                {cacertfile, "/etc/rabbitmq/cacert.pem"},
                {certfile,   "/etc/rabbitmq/cert.pem"},
                {keyfile,    "/etc/rabbitmq/key.pem"},
                {password, ""},
                {verify,verify_none},
                {fail_if_no_peer_cert,false}
               ]}]
},    
{rabbitmq_management,
 [{listener, [{port, 15672},
              {ssl, true},
              {ssl_opts, [{cacertfile, "/etc/rabbitmq/cacert.pem"},
                          {certfile,   "/etc/rabbitmq/cert.pem"},
                          {keyfile,    "/etc/rabbitmq/key.pem"}]}
             ]}]
 }
].
michaelklishin commented 7 years ago

I can reproduce.

You can do two things to wrk around:

michaelklishin commented 7 years ago

@essen I have a workaround but still curious: when this plugin is disabled, should we stop the listener? If so, what'd be the right (and safe) way to do it?

michaelklishin commented 7 years ago

To clarify: I'm not sure if we can safely stop the listener in case there are more plugins using HTTP enabled. Plugins should unbind from the ports they use, of course.