Only register the first web-dispatch listener

The problem: on certain double IPv4 and IPv6 environments, web-dispatch
will start a single listener (for management for example) but will
register two listeners in the Rabbit Mnesia table. Later, RabbitMQ
will crash when trying to stop or suspend them (rabbitmq-upgrade drain)
because only one of the two listeners exist in Ranch.

The fix: we register only the first listener, because that's the one
we used to create the Ranch ref (see rabbit_networking:ranch_ref/1).
This commit is contained in:
Loïc Hoguin 2021-05-03 13:52:17 +02:00
parent 787b46e3a1
commit 9eaea139e3
No known key found for this signature in database
GPG Key ID: C69E26E3A9DF618F
1 changed files with 3 additions and 3 deletions

View File

@ -157,9 +157,9 @@ listener_info(Listener) ->
P
end,
Port = pget(port, Listener),
[{Protocol, IPAddress, Port}
|| {IPAddress, _Port, _Family}
<- rabbit_networking:tcp_listener_addresses(Port)].
[{IPAddress, _Port, _Family} | _]
= rabbit_networking:tcp_listener_addresses(Port),
[{Protocol, IPAddress, Port}].
lookup_dispatch(Lsnr) ->
case ets:lookup(?ETS, pget(port, Lsnr)) of