[Why]
The downstream process was already handling a `{shutdown, Term}`
termination reason from upstream gracefully: it would log a message an
close the connection.
However it didn't handle the more common `shutdown` reason, which
happens with a regular stop of the upstream node. It led to the log of a
giant scary crash message.
[How]
We handle `shutdown` the same as `{shutdown, Term}`.
(cherry picked from commit 2a23ccbcd9)
`rabbit_nodes_common:ensure_epmd/0` unconditionally starts EPMD by
spawning `erl` with nodename options. Spawning `erl` can be quite slow
though (around 250ms for me locally), so we should try to avoid it when
we detect that EPMD is already running.
We can relatively cheaply check whether EPMD is already running with
`net_adm:names/0`, a function that asks the daemon on localhost to list
any registered names, the same as `epmd -names` on the comand line. If
we can successfully get the list of names from the daemon then we don't
need to start EPMD. `net_adm:names/0` is relatively cheap compared to
running `erl`, costing around 8ms when EPMD is running and less than a
millisecond when it is not.
This improves the CLI's total run time for commands that read the
`enabled_plugins_file` and `plugins_dir` config options. Those options
try to consult a running node and so they start distribution and ensure
that EPMD is running. `rabbitmqctl --help` saves nearly 500ms when EPMD
is already running as it reads both options, since previously it
spawned and blocked on `erl` when reading each option.
(cherry picked from commit 46ca3269e3)
Prior to this commit test block_connack_timeout
flaked when 2 new ports got created instead of only 1
in line
```
[NewPort] = Ports -- Ports0,
```
This commit filters for tcp_inet ports.
This will always return the port of the new MQTT connection.
(cherry picked from commit bedcae18c2)
Per discussion in #10415, this introduces a new module,
rabbit_mgmt_nodes, which provides a couple of helpers
that can be used to implement Cowboy REST's
resource_exists/2 in the modules that return
information about cluster members.
(cherry picked from commit 0c0e2ca932)
The behaviour of this module is to fragile to potentially allow a regression
here so we explicitly ping_all/0 before filtering running nodes.
(cherry picked from commit d74821581b)
Ram nodes are a deprecated feature and the actual assertion is
quite a complicated once that isn't easy to reason about as it
asserts on the cluster view of nodes that that have their
rabbit app stopped.
(cherry picked from commit 87664e9fcb)
# Conflicts:
# deps/rabbit/test/clustering_management_SUITE.erl
As this will force erlang to attempt to set up a distribution connection
to the down node. This can take some time, especially in cloud environments.
(cherry picked from commit 8aa217613c)
Must be a leftover from the refactoring in commit 0a87aea
This should prevent the below crash that was seen with an exchange
federation link
```
{undef,
[{supervisor2,try_again_restart,
[<0.105395.0>,
{upstream,
[{encrypted,
<<"...">>}],
<some mirrored supervisor data>},
{upstream,
[{encrypted,
<<"...">>}],
<some mirrored supervisor data>}],
[]}]}
```
(cherry picked from commit b6f782fd0d)
[Why]
We need to do this for the `terminate/3` to be called. Without this, the
process exits without calling it.
(cherry picked from commit a472982d26)