Commit Graph

2244 Commits

Author SHA1 Message Date
dcorbacho 0cec212896 Stream queue data dir 2020-09-30 14:41:59 +01:00
Michael Klishin 5a215e0f03 Merge branch 'master' into lrb-update-supervisor 2020-09-30 11:22:15 +03:00
Michael Klishin 8f7ecf363f Migrate a supervisor2 suite by @lukebakken from rabbitmq-server
References rabbitmq/rabbitmq-server#2457.
2020-09-30 11:00:32 +03:00
Luke Bakken 39ec461331 Fix transient type handling 2020-09-29 13:49:34 -07:00
Luke Bakken a0bd637558 Fix function ordering to restart correctly. Reduce log spam. 2020-09-29 11:52:35 -07:00
Luke Bakken 6ed6573cef Update mix_task_archive_deps version
https://github.com/rabbitmq/mix_task_archive_deps/releases/tag/0.5.0

See this as well:

https://github.com/rabbitmq/mix_task_archive_deps/pull/2

https://groups.google.com/d/topic/rabbitmq-users/0d8TBs_qmGE/discussion
2020-09-28 15:36:02 -07:00
Michael Klishin 2c14e1dd3f Merge branch 'master' into lrb-update-supervisor 2020-09-26 10:00:57 +03:00
Michael Klishin 160742ea8a rpc module calls can return a {badrpc, term()} 2020-09-24 23:15:32 +03:00
dcorbacho 9c56b0cffc Add get_auth_attempts_by_source api 2020-09-23 15:52:50 +01:00
Luke Bakken c1d59f600c Remove tabs 2020-09-22 12:13:44 -07:00
Luke Bakken 111124bc05 Several bug fixes found when running tests
Validate delay value
2020-09-22 12:08:32 -07:00
dcorbacho 8bb1fbdf3d Merge remote-tracking branch 'origin/master' into auth-attempt-metrics 2020-09-22 17:11:08 +01:00
dcorbacho 0d09fb0a85 Split auth attempt metrics into global and detailed
GC collection can then be done by deleting all entries on the ETS table
and total counters per protocol can be kept without individually scanning
all entries
2020-09-22 16:47:10 +01:00
dcorbacho 4c6251d3fb Include protocol in auth metrics 2020-09-22 16:46:52 +01:00
Luke Bakken db7dfdf0cf Remove old supervisor2 module 2020-09-21 15:15:11 -07:00
Luke Bakken 0a87aeace5 Begin migration of code from supervisor2 to the 22.3.4.10 version
Moved a lot of code from old supervisor to new one

All compilation errors fixed

Use the macro, Luke
2020-09-21 15:14:49 -07:00
Philip Kuryloski c1a4790c7b Erlang 21.3 -> 22.3 for `make github-actions`
This has no direct effect until GitHub Actions workflows are
regenerated using make
2020-09-02 10:21:20 +02:00
Luke Bakken 4c9d67bb9d Do not change the behavior of rpc_call 2020-09-02 03:42:58 +03:00
Luke Bakken bf199aa36c Set RPC_TIMEOUT to 15 seconds 2020-09-02 03:42:58 +03:00
Luke Bakken 3f1c26d951 Add function to allow setting timeout on multicall
A timeout will be handled as an empty result.

@michaelklishin - should that be logged?
2020-09-02 03:42:58 +03:00
dcorbacho 4ad6396475 Add auth attempt metrics 2020-08-28 13:21:13 +01:00
Michael Klishin 8f2df3bad0 Bump credentials_obfuscation to 2.2.0 2020-08-20 14:27:01 +03:00
Jean-Sébastien Pédron 94de4c07ba rabbit_nodes_common: Disable Dialyzer warning for diagnostics_node/1
net_adm:name/1 returns a new value, 'noport', in Erlang 24. This value
being absent in the function spec in previous versions of Erlang, we get
a warning from Dialyzer until we start to the yet-to-be-release Erlang
24 in CI. Therefore we disable this specific warning.
2020-08-20 14:27:01 +03:00
Jean-Sébastien Pédron 2f779e8668 rabbit_nodes_common: Handle `noport` return value from net_adm:names/1
This is a new return value in Erlang 24 when the hostname passed to
net_adm:names/1 couldn't be resolved.
2020-08-20 14:27:01 +03:00
Jean-Sébastien Pédron 32be18d42a rabbitmq-dist.mk: Exclude `ebin/dep_built` from plugin packaging
This is a state file for Erlang.mk only.
2020-08-20 14:27:01 +03:00
Jean-Sébastien Pédron f59db9f8a6 rabbitmq-dist.mk: Package plugins as directories by default
... instead of .ez archives.

The benefits for doing this:

* We can use native code, as is the case for lz4 and zstd bindings in
  the Tanzu RabbitMQ version for instance. Indeed, Erlang does not
  support loading native code (NIF or port drivers) from .ez archives.

* We can remove custom code to handle .ez archives. We have special
  cases in Erlang.mk plugins as well as the `rabbit_plugins` module, in
  particular the code to extract .ez archives (even though Erlang knows
  how to use them directly).

* Prevent hard to debug situations when the .ez archive name does not
  match the top-level directory inside the archive. In this case, Erlang
  says it can't load the application but doesn't tell much more.

* Debugging and "hot-patching" plugins become easier: we just have to
  copy the recompiled .beam file in place of the existing one. There
  is no need to unpack the plugin, replace the file and recreate the
  archive.

* Release packages can be smaller. gzip, bzip2 and xz, common
  compression algorithm for Unix packages, give much better result if
  they compress the .beam files directly instead of "compressing" zip
  files (the .ez archives are plain zip archives). For instance, the
  generic-unix package goes from 15 MiB when using .ez archives to just
  12 MiB when using directory.

I would also like to experiment with Erlang releases in the future.
Using directories for Erlang applications instead of .ez archives is
mandatory for this to work according to my latest tests.

Of course, this change doesn't break support for .ez archives (and we
will keep support for this). End users can still download third-party
plugins as .ez archives and drop them in the plugins directory.
2020-08-20 14:27:01 +03:00
Luke Bakken d9b352a8ff Avoid using os:find_executable to find erl
On Windows, the current working directory is also searched, which can
lead to problems. Instead, use `init:get_argument(root)` to get the root
of the Erlang release, then we know `bin/erl` will always be present.
2020-08-20 14:27:01 +03:00
Luke Bakken 866b810d0e rabbitmq-components.mk: Improve top-level DEPS_DIR detection for rabbit_prelaunch 2020-08-20 14:27:00 +03:00
Jean-Sébastien Pédron efda8c587e rabbitmq-components.mk: Improve top-level DEPS_DIR detection
In addition to the `rabbitmq-components.mk` existence check, we now
verfy that the directory is named `deps`.

This is to increase the chance that, if we find a
`rabbitmq-componentS.mk` file in the upper directories, this project is
indeed inside a DEPS_DIR.

For instance, in our GitHub Actions workflows, when we prepared the
secondary umbrellas for mixed-version testing, it happened that the
secondary umbrellas were under a clone of rabbitmq-server. Therefore
the first (and only) condition was met and the Makefile erroneously
considered it was inside a DEPS_DIR. As a consequence, dependencies of
the umbrellas were fetched in the wrong place.
2020-08-20 14:27:00 +03:00
Luke Bakken 700fbd7873 Update method to determine dependency directories
This new method by @dumbbell will work with any sub-component, not just the umbrella
2020-08-20 14:27:00 +03:00
Michael Klishin 2aa5d04a9f Bump credentials_obfuscation to 2.1.1 2020-08-20 14:27:00 +03:00
Jean-Sébastien Pédron 9bec817372 GitHub Actions: Default to Erlang 21.3 and 23.0 2020-08-20 14:27:00 +03:00
dcorbacho cbd99c9b4c Update erlang.mk 2020-08-20 14:27:00 +03:00
Michael Klishin bd6c8932a9 Bump stdout_formatter to 0.2.4 2020-08-20 14:27:00 +03:00
Michael Klishin 839f7ca7d1 Bump sysmon_handler to 1.3.0 2020-08-20 14:26:59 +03:00
Michael Klishin 362f0edc06 Bump JSX to 2.11.0 2020-08-20 14:26:59 +03:00
dcorbacho 09c2760bb4 Revert drop of Exhibit B on MPL 2.0 2020-08-20 14:26:59 +03:00
Michael Klishin 4deee618ab Bump credentials_obfuscation to 2.2.0 2020-08-14 08:02:13 +03:00
Jean-Sébastien Pédron d82cf55e3e rabbit_nodes_common: Disable Dialyzer warning for diagnostics_node/1
net_adm:name/1 returns a new value, 'noport', in Erlang 24. This value
being absent in the function spec in previous versions of Erlang, we get
a warning from Dialyzer until we start to the yet-to-be-release Erlang
24 in CI. Therefore we disable this specific warning.
2020-08-13 15:02:51 +02:00
Jean-Sébastien Pédron 9c2f7ee01f rabbit_nodes_common: Handle `noport` return value from net_adm:names/1
This is a new return value in Erlang 24 when the hostname passed to
net_adm:names/1 couldn't be resolved.
2020-08-13 14:36:04 +02:00
Jean-Sébastien Pédron ebd88bc7e8 rabbitmq-dist.mk: Exclude `ebin/dep_built` from plugin packaging
This is a state file for Erlang.mk only.
2020-08-11 16:19:19 +02:00
Michael Klishin 406fe48fce Merge branch 'master' into lrb-find-erl-safely 2020-08-09 04:12:43 +03:00
Jean-Sébastien Pédron 9d62a6df30 rabbitmq-dist.mk: Package plugins as directories by default
... instead of .ez archives.

The benefits for doing this:

* We can use native code, as is the case for lz4 and zstd bindings in
  the Tanzu RabbitMQ version for instance. Indeed, Erlang does not
  support loading native code (NIF or port drivers) from .ez archives.

* We can remove custom code to handle .ez archives. We have special
  cases in Erlang.mk plugins as well as the `rabbit_plugins` module, in
  particular the code to extract .ez archives (even though Erlang knows
  how to use them directly).

* Prevent hard to debug situations when the .ez archive name does not
  match the top-level directory inside the archive. In this case, Erlang
  says it can't load the application but doesn't tell much more.

* Debugging and "hot-patching" plugins become easier: we just have to
  copy the recompiled .beam file in place of the existing one. There
  is no need to unpack the plugin, replace the file and recreate the
  archive.

* Release packages can be smaller. gzip, bzip2 and xz, common
  compression algorithm for Unix packages, give much better result if
  they compress the .beam files directly instead of "compressing" zip
  files (the .ez archives are plain zip archives). For instance, the
  generic-unix package goes from 15 MiB when using .ez archives to just
  12 MiB when using directory.

I would also like to experiment with Erlang releases in the future.
Using directories for Erlang applications instead of .ez archives is
mandatory for this to work according to my latest tests.

Of course, this change doesn't break support for .ez archives (and we
will keep support for this). End users can still download third-party
plugins as .ez archives and drop them in the plugins directory.
2020-08-07 17:22:47 +02:00
Luke Bakken b499da835e Avoid using os:find_executable to find erl
On Windows, the current working directory is also searched, which can
lead to problems. Instead, use `init:get_argument(root)` to get the root
of the Erlang release, then we know `bin/erl` will always be present.
2020-08-07 08:06:43 -07:00
Luke Bakken a127b7fada rabbitmq-components.mk: Improve top-level DEPS_DIR detection for rabbit_prelaunch 2020-08-04 08:55:08 -07:00
Jean-Sébastien Pédron 4934e2b01e rabbitmq-components.mk: Improve top-level DEPS_DIR detection
In addition to the `rabbitmq-components.mk` existence check, we now
verfy that the directory is named `deps`.

This is to increase the chance that, if we find a
`rabbitmq-componentS.mk` file in the upper directories, this project is
indeed inside a DEPS_DIR.

For instance, in our GitHub Actions workflows, when we prepared the
secondary umbrellas for mixed-version testing, it happened that the
secondary umbrellas were under a clone of rabbitmq-server. Therefore
the first (and only) condition was met and the Makefile erroneously
considered it was inside a DEPS_DIR. As a consequence, dependencies of
the umbrellas were fetched in the wrong place.
2020-07-30 12:01:44 +02:00
Luke Bakken 8f4f0c9618 Update method to determine dependency directories
This new method by @dumbbell will work with any sub-component, not just the umbrella
2020-07-29 10:01:42 -07:00
Michael Klishin 2473d9e62c Bump credentials_obfuscation to 2.1.1 2020-07-29 04:42:02 +03:00
Jean-Sébastien Pédron 782bead4c0 GitHub Actions: Default to Erlang 21.3 and 23.0 2020-07-24 16:03:04 +02:00
dcorbacho f9228fb071 Update erlang.mk 2020-07-21 14:31:38 +01:00
Michael Klishin 1b89b2203d Bump stdout_formatter to 0.2.4 2020-07-21 13:12:36 +03:00
Michael Klishin a27969c2f2 Bump sysmon_handler to 1.3.0 2020-07-21 03:42:37 +03:00
Michael Klishin 3e668819e3 Bump JSX to 2.11.0 2020-07-21 03:42:37 +03:00
dcorbacho 749e5c9ee1 Revert drop of Exhibit B on MPL 2.0 2020-07-20 16:55:58 +01:00
Anupama Singh 9495a5f8cb user_limits feature flag implementation 2020-07-17 15:55:47 +01:00
Ayanda-D acb586e0a9 Per-user connection and channel tracking records, definitions, types 2020-07-17 15:55:47 +01:00
Anupama Singh 3ce3b9d995 New field limits in #internal_user to store the user limits 2020-07-17 15:54:18 +01:00
Michael Klishin 8780e4eee0 Update MPL2 license file, drop Exhibit B
and add a VMware copyright notice.

We did not mean to make this code Incompatible with Secondary Licenses
as defined in [1].

1. https://www.mozilla.org/en-US/MPL/2.0/FAQ/
2020-07-17 14:53:09 +03:00
Michael Klishin d1f27b08b8 Drive by change: squash a compiler warning 2020-07-14 03:50:09 +03:00
Michael Klishin 2b80223ed6 Initial API bits for marking a node as being drained (or not)
Part of #2321.
2020-07-14 03:50:09 +03:00
Michael Klishin 58dc58d846 Introduce node maintenance state record 2020-07-14 03:50:08 +03:00
Michael Klishin 62c08ca4c6 Merge branch 'master' into switch-to-MPL-2.0 2020-07-10 13:01:20 +03:00
Jean-Sébastien Pédron 368586ec1b Switch to Mozilla Public License 2.0 (MPL 2.0) 2020-07-07 18:06:39 +02:00
Jean-Sébastien Pédron 33acee94cc rabbit_env: Give precedence to $RABBITMQ_* prefixed variables in the output of $CONF_ENV_FILE
When we source the $CONF_ENV_FILE script, we set a few variables which
this script expects. Those variables are given without their prefix. For
instance, $MNESIA_BASE.

The $CONF_ENV_FILE script can set $RABBITMQ_MNESIA_BASE. Unfortunately
before this patch, the variable would be ignored, in favor of the
default value which was passed to the script ($MNESIA_BASE).

The reason is that variables set by the script are handled in the
alphabetical order. Thus $MNESIA_BASE is handled first, then
$RABBITMQ_MNESIA_BASE.

Because the code didn't give any precedence, the first variable set
would "win". This explains why users who set $RABBITMQ_MNESIA_BASE in
$CONF_ENV_FILE, but using RabbitMQ 3.8.4+ (which introduced
`rabbit_env`), unexpectedly had their node use the default Mnesia base
directory.

The patch is rather simple: when we check if a variable is already set,
we give precedence to the $RABBITMQ_* prefixed variables. Therefore, if
the $CONF_ENV_FILE script sets $RABBITMQ_MNESIA_BASE, this value will be
used, regardless of the value of $MNESIA_BASE.

This didn't happen with variables set in the environment (i.e. the
environment of rabbitmq-server(8)) because the prefixed variables
already had precedence.

Fixes rabbitmq/rabbitmq-common#401.
2020-07-07 16:28:18 +02:00
Jean-Sébastien Pédron 9ab7942d83 rabbit_log: Add Logger handler's log/2 API
This allows RabbitMQ to configure `rabbit_log` as a Logger handler.

See a related commit in rabbit_prelaunch_early_logging in
rabbitmq-server, where `rabbit_log` is being configured as a Logger
handler. The commit message explains the reason behind this.
2020-07-06 14:18:05 +02:00
Jean-Sébastien Pédron 878c5e23cd Update erlang.mk 2020-06-23 17:12:59 +02:00
Jean-Sébastien Pédron 061f306ced GitHub Actions: Fix mentions of "rabbitmq-cli" 2020-06-10 17:47:33 +02:00
Jean-Sébastien Pédron 78585ad70a GitHub Actions: Trigger rabbitmq-server workflows after a commit
... to this repository's `master` branch.

The idea is to make sure rabbitmq-server is tested against this new
version of rabbitmq-common.
2020-06-10 16:35:15 +02:00
Michael Klishin a5923705f7 Bump Recon to 2.5.1
for Erlang 23 compatibility of 'rabbitmq-diagnostics observer'

References zhongwencool/observer_cli#68.
2020-06-09 08:22:15 +03:00
Michael Klishin 0e577ee358 Merge branch 'master' into rabbitmq-cli-424 2020-06-05 17:22:08 +03:00
Michael Klishin 5a74a54dd4 Introduce a way to list available NICs in a more presentable format
Part of rabbitmq/rabbitmq-cli#424
2020-06-05 17:21:39 +03:00
Jean-Sébastien Pédron 76a789fbac rabbit_env_SUITE: Prevent load of `$CONF_ENV_FILE` for the entire testsuite
It avoids any pollution from the environment.
2020-06-05 11:43:22 +02:00
Jean-Sébastien Pédron 1ca5c3e72e rabbit_env_SUITE: Test context_to_code_path() for Windows as well 2020-06-05 11:43:14 +02:00
Jean-Sébastien Pédron 474ab2204c rabbit_env: Use the context's OS type in get_user_lib_dirs() 2020-06-05 10:21:06 +02:00
Jean-Sébastien Pédron b002ad6eed rabbit_env: Organize Unix' do_load_conf_env_file as the Window version 2020-06-05 10:21:06 +02:00
Luke Bakken d6a16caa9b rabbit_env: Add support for RABBITMQ_CONF_ENV_FILE on Windows
Fixes #392

Fixes from ERL-1269

match the map

deal with line endings
2020-06-05 10:21:00 +02:00
Michael Klishin 9f6087acc6 Message store settings we already have use the "msg_store" prefix 2020-06-03 20:36:17 +03:00
Philip Kuryloski c40c2628a9 Add a specific shutdown timeout macro and property for message stores
The default timeout of 30 seconds was not sufficient to allow graceful shutdown of a message store with millions of persistent messages. Rather than increase the timeout in general, introduce a new macro with a default of 600 seconds
2020-06-02 14:37:13 +02:00
Michael Klishin c3db0a1beb Introduce rabbit_types:error/2
Part of #2356.
2020-05-30 04:41:29 +03:00
Jean-Sébastien Pédron e6f383dd94 GitHub Actions: Pass files between jobs using artefacts
... instead of the cache action.

The cache action is quite unstable (failing to download the cached
files). In this commit, we try to use the artefacts instead. At this
point, we don't know if it is more reliable, but we'll see with time.

As an added bonus, we can download the archives passed between jobs for
inspection if we need.
2020-05-25 10:18:16 +02:00
Michael Klishin e629102397 Update type specs in rabbit_pbe
In follow-up to rabbitmq/rabbitmq-server#2351, #389.
2020-05-22 16:05:35 +03:00
Luke Bakken fe6312f0ca Add function heads to rabbit_pbe to take credentials-obfuscation 2.0 into account 2020-05-20 19:04:28 -07:00
Luke Bakken 846ac6e957 Update to credentials_obfuscation 2.0
Part of the following:
https://github.com/rabbitmq/credentials-obfuscation/pull/5
2020-05-20 16:08:26 -07:00
Jean-Sébastien Pédron 8d5ddda02a rabbitmq-build.mk: Don't add rabbitmq_cli to compiler path in amqp_client
Otherwise, for instance, running Dialyzer in the Erlang client fails with the
following error if it was cloned directly (i.e. outside of the Umbrella):

dialyzer: Bad directory for -pa: .../amqp_client/deps/rabbitmq_cli/_build/dev/lib/rabbitmqctl/ebin
2020-05-20 17:37:12 +02:00
Jean-Sébastien Pédron 64975ffe47 Revert switch to sys:get_log/1
It  does not exist in Erlang 21.
2020-05-19 17:06:50 +02:00
Jean-Sébastien Pédron 148a40a095 Address deprecation of erlang:get_stacktrace/0 and sys:get_debug/3 2020-05-19 16:48:59 +02:00
Jean-Sébastien Pédron 228aaf5885 GitHub Actions: Run Dialyzer with the latest Erlang version 2020-05-11 12:59:50 +02:00
Jean-Sébastien Pédron fae348f0ed GitHub Actions: Recreate secondary umbrellas in case of cache failure
We don't want the job to fail just because GitHub Actions failed to
restore the cache of the secondary umbrellas. We can just recreate them.
2020-05-11 12:58:41 +02:00
Jean-Sébastien Pédron 681bd126e0 GitHub Actions: Improve caching of secondary umbrellas
The cache key is based on the list of umbrellas included and the version
of Erlang because we now run `make test-dist` in the relevant project.
2020-05-07 12:57:34 +02:00
Jean-Sébastien Pédron 29856aad84 rabbit_env: Add get_used_env_vars/0 to fetch variables used by rabbit_env
... and their value.

Both prefixed and non-prefixed variables are returned by this function.

While here, fix a conflict between $RABBITMQ_HOME and $HOME in
var_is_used/1: the latter shouldn't be considered as used.
2020-05-06 18:32:21 +02:00
Gerhard Lazu eb29dd4dd2 Trigger test workflows on new-commit-to-dep-release-branch events
Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2020-05-01 13:00:45 +01:00
Jean-Sébastien Pédron 0d27b9ad20 GitHub Actions: Add mixed-version cluster testing
When we generate the workflows, we pick the latest tag of each release
branch. That list of tags is used to clone secondary umbrellas in the
workflows and run the testsuites against each of them.

When generating workflows for `master`, we take the latest tag of each
release branch.

When generating workflows for a release branch, we take the latest tag
of each older release branch, plus the first tag of the same release
branch.

Some examples:
* `master` is tested with 3.8.3 and 3.7.25
* `v3.8.x` is tested with 3.8.0 and 3.7.25
2020-04-30 17:12:34 +02:00
Jean-Sébastien Pédron a6297a6589 GitHub Actions: Move `make bats` to rabbitmq-server
This is specific to rabbitmq-server and won't work in any other
repository.
2020-04-30 17:12:09 +02:00
Jean-Sébastien Pédron d409fd268a GitHub Actions: Rename template chunks to leave room 2020-04-30 16:59:10 +02:00
Jean-Sébastien Pédron 287fdefd15 GitHub Actions: Remove '/' from workflow names 2020-04-30 16:59:10 +02:00
Jean-Sébastien Pédron 7987702cdb GitHub Actions: Pass FAIL_FAST=1 and SKIP_AS_ERROR=1 to `make ct`
With this variable passed, testing will stop at the first failure
(instead of trying all testcases) and a skipped testcase is considered a
failure.
2020-04-30 16:59:10 +02:00
Jean-Sébastien Pédron a442dc597c GitHub Actions: Set vim shiftwidth & expandtab in headers 2020-04-30 15:48:25 +02:00
Jean-Sébastien Pédron 876552c95e rabbitmq-plugin.mk: Fix copy-paste error 2020-04-30 12:35:24 +02:00
Jean-Sébastien Pédron a8a47a42e3 GitHub Actions: Upload rabbitmq-deps.mk to S3 only for `master` & release branches 2020-04-28 13:19:38 +02:00
Jean-Sébastien Pédron 8006d36c04 rabbitmq-github-actions.mk: Set `DO_COMMIT=yes` to automatically commit
... the generated workflows.
2020-04-28 13:16:37 +02:00
Jean-Sébastien Pédron cf7041421a rabbitmq-github-actions.mk: Use $(base_rmq_ref) from rabbitmq-components.mk
..in templates.
2020-04-28 13:16:17 +02:00
Jean-Sébastien Pédron 1f623b1c07 GitHub Actions: Replace a hard-coded "21.3" by $(ERLANG_VERSION) 2020-04-27 17:56:10 +02:00
Jean-Sébastien Pédron 3c6a4c1f15 GitHub Actions: Use GitHub Actions "run_id" when uploading rabbitmq-deps.mk to S3
We need a monotonically increasing number for the version used by the
Concourse S3 resource. A Git commit hash does not work because they do
not have this property.
2020-04-27 14:46:13 +02:00
Jean-Sébastien Pédron 2b1e0f4bfc GitHub Actions: Don't cache `ebin` for now
It messes with Erlang.mk when a workflow is restarted, leading to a
failure in `make xref`.
2020-04-27 14:45:59 +02:00
Jean-Sébastien Pédron 7bf6f736a3 rabbitmq-github-actions.mk: New Erlang.mk plugin to help manage GitHub Actions workflows
The main entry point is `make github-actions` which generates the
workflows.

Currently, it handles workflows to test the project with different
versions of Erlang.
2020-04-27 13:22:34 +02:00
Jean-Sébastien Pédron 2d4b898b23 rabbitmq-tools.mk: Add project name & commit hash as a comment in rabbitmq-deps.mk
The comment is on the first line of the `$(PROJECT)-rabbitmq-deps.mk`
file.
2020-04-27 12:52:54 +02:00
Michael Klishin a8017e8675 rabbit_event:notify/{2,3}: support map events 2020-04-25 21:48:47 +03:00
Jean-Sébastien Pédron 509a218013 rabbitmq-tools.mk: New `rabbitmq-deps.mk` target
It generates a file called `$(PROJECT)-rabbitmq-deps.mk` which has a
dependency definition line of the form expected by Erlang.mk, for each
RabbitMQ component the project depends on.

Therefore the line indicates:
* `git` as the fetch method
* the repository URL
* the Git commit hash the dependency is on

Here is an example for rabbitmq-server:

    dep_rabbit_common := git https://github.com/rabbitmq/rabbitmq-common.git d9ccd8d9cdd58310901f318fed676aff59be5afb
    dep_rabbitmq_cli := git https://github.com/rabbitmq/rabbitmq-cli.git f6eaae292d27da4ded92b7c1b51a8ddcfefa69c2
    dep_rabbitmq_codegen := git https://github.com/rabbitmq/rabbitmq-codegen.git 65da2e86bd65c6b6ecd48478ab092721696bc709
2020-04-22 11:57:38 +02:00
Jean-Sébastien Pédron 2e06989877 Update erlang.mk 2020-04-21 15:52:57 +02:00
Luke Bakken af7466c1c8 Use PLATFORM to determine hostname command 2020-04-20 07:50:57 -07:00
Luke Bakken 30dbad3214 Use "hostname -s" only on Darwin
Fixes #374
2020-04-17 12:31:08 -07:00
Jean-Sébastien Pédron f818953072 rabbitmq-dist.mk: Fix incorrect quoting in install-cli-scripts
The double-quoting was requited in the flock(1)/lockf(1) blocks because
of the use of `sh -c`. However it's incorrect in the `else` block.

Follow-up to commit 3f32a36e50.
2020-04-15 13:56:05 +02:00
Jean-Sébastien Pédron e3cd5fad8d rabbitmq-run.mk: Replace two CLI calls with fast equivalents
The CLI has a high startup time. To speed up the
`start-background-broker` and `stop-node` recipes, two CLI calls are
replaced by two more basic commands which achieve the same goal.
2020-04-14 14:20:04 +02:00
Jean-Sébastien Pédron 3f32a36e50 rabbitmq-dist.mk: Defer computation of `$rabbit_scripts_dir` to install-cli-scripts recipe
The problem with the previous approach was that the `$(wildcard ...)`
directives might be evaluated too early: `deps/rabbit` might not be
available yet.

Moving the computation to the body of the recipe fixes the problem
because dependencies are available at this point.
2020-04-14 14:18:07 +02:00
Jean-Sébastien Pédron b93b89187b rabbitmq-dist.mk: Fix `install-cli-scripts` when rabbit is top-level
In other words, if instead of cloning the Umbrella, one cloned
rabbitmq-server directly, the `install-cli-scripts` recipe would fail to
copy the scripts because it assumed `rabbit` was under `$(DEPS_DIR)`.

Now expected places are checked and an error is emitted if the recipe
can't find the right one.
2020-04-06 13:07:58 +02:00
Philip Kuryloski 7ef99b8e25 Avoid the dependency on rabbit_ct_helpers in worker_pool_SUITE
This breaks the cyclic dependency between rabbitmq_ct_helpers and
rabbit_common.
2020-03-25 10:33:06 +01:00
Michael Klishin 435e493491 Add rabbitmq_ct_helpers to test dependencies
Requried as of #368.
2020-03-25 01:15:49 +03:00
Philip Kuryloski 4c73437a33 Move over worker_pool_SUITE from rabbitmq-server
to consolidate worker pool tests in a single location
2020-03-23 15:26:31 +01:00
Philip Kuryloski 3c0617eef0 use is_process_alive for a cleaner test
according to Michael's suggestion
2020-03-23 15:26:31 +01:00
Philip Kuryloski 16151baba3 Add worker_pool:dispatch_sync funtion
dispatch_sync sits inbetween the behavior of submit and submit_async,
blocking the caller until a worker begins the task, as opposed
to not blocking at all, or blocking util the task has finished.
This is useful when you want to throttle submissions to the pool
from a single process, such that all workers are busy, but there
exists no backlog of work for the pool.
2020-03-20 15:22:19 +01:00
Jean-Sébastien Pédron c6b0d1a767 rabbitmq-run.mk: Remove uses of $RABBITMQ_SCHEMA_DIR
This is unused by RabbitMQ after the completion of
rabbitmq/rabbitmq-server#2180.
2020-03-19 10:36:39 +01:00
Gerhard Lazu c96f6153b3 Default TAR to tar, use gtar on FreeBSD & Darwin
On Darwin, the default tar fails with unkown --transform flag.

FAILS:          bsdtar 2.8.3 - libarchive 2.8.3
SUCCEEDS:       tar (GNU tar) 1.32

re https://github.com/rabbitmq/rabbitmq-common/pull/364

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2020-03-18 15:19:49 +01:00
Jean-Sébastien Pédron 95013577ce rabbitmq-tools.mk: Exclude nodes' `mnesia` directory form archive
Those directories can be large and don't carry much value in the context
of the common_test logs.

While here, rename the target to `ct-logs-archive`.
2020-03-18 13:59:50 +01:00
Jean-Sébastien Pédron a070290864 rabbitmq-tools.mk: Add compress-ct-logs target
If there are common_test logs (i.e. `logs` exists), it creates an archive
(compressed with xz(1)) in the top-level directory.

The archive is named `$(PROJECT)-ct-logs-$timestamp.tar.xz` by default.
The name can be changed by setting `$(CT_LOGS_ARCHIVE)`. The file
extension must be `.tar.xz`.
2020-03-17 19:30:48 +01:00
Jean-Sébastien Pédron bb3f355b37 rabbitmq-run.mk: Build RabbitMQ once when using start-{brokers,cluster}
... instead of once per started nodes.
2020-03-17 18:42:12 +01:00
Jean-Sébastien Pédron 13bbfa0dfd rabbitmq-run.mk: Use := instead of ?= in target-specific var. assignment
The documentation says we should be able to use ?=, but apparently it
affects the way variables are passed to sub-make.

The issue we had is that using: `make start-cluster RABBITMQ_CONFIG_FILE=...`
didn't work as expected: `$(RABBITMQ_CONFIG_FILE)` made it to the
sub-make but not to the sub-make's recipe.

Using := fixes the problem.

Doing that is ok because assigning `$(RABBITMQ_CONFIG_FILE)` in the
environment or on make(1)'s command line will override the
target-specific variable anyway.
2020-03-17 18:38:20 +01:00
Jean-Sébastien Pédron b175b2e667 rabbitmq-run.mk: Re-use $(comma) from Erlang.mk 2020-03-17 18:34:54 +01:00
Luke Bakken d59d332bd1 Fix leading tabs 2020-03-16 07:52:23 -07:00
Michael Klishin 47e8053a41 (c) updates for 2020
Pair: @dumbbell.
2020-03-16 15:00:48 +03:00
Michael Klishin 982df58b0f rabbit_nodes_common:make/1: support node parts that are not strings
Such as atoms and binaries.

Pair: @dumbbell.
2020-03-16 15:00:48 +03:00
Gerhard Lazu 382565c507 Double-escape \ so that the config file is generated correctly
Thanks @lukebakken!

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2020-03-16 10:52:39 +00:00
Gerhard Lazu 7bfbdba2df Use a better colour for all debug logs
They were plain by default & are now blue which works really well with
Gruvbox Dark. I couldn't change just the debug color, had to redefine
them all.

cc @dumbbell @lukebakken

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2020-03-13 23:21:03 +00:00
Gerhard Lazu 1da5f922fe Keep test_rabbitmq_config_with_tls in sync with the default one
Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2020-03-13 23:19:39 +00:00
Gerhard Lazu f54691f4b9 Enable colourful debug logging by default
When running the broker locally, in dev, this is what most of us want.
To change this, use e.g. RABBITMQ_LOG=info (previous default).

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2020-03-11 12:02:04 +00:00
Jean-Sébastien Pédron fa4b552a9b Update copyright (year 2020) 2020-03-10 15:26:49 +01:00
Jean-Sébastien Pédron 6d48b5f7d3 rabbitmq-run.mk: Set Ra's wal_sync_method to `sync`
This turns off WAL preallocation and saves 400+ MiB per node directory.

This setting only applies to nodes started with `make run-broker` or
from our testsuites. RabbitMQ default configuration remains unaffected.
2020-03-09 13:03:12 +01:00
Jean-Sébastien Pédron 979b6f6972 rabbitmq-dist.mk: Change the condition again to match $(PORJECT) instead
Using dependencies seemed sensible in the first place, but they are also
special cases like `rabbit` itself. In the end, it looks simpler to just
list rabbitmq-common and rabbitmq-amqp1.0-common in a blacklist and
install CLI for everything else.
2020-03-06 14:04:22 +01:00
Jean-Sébastien Pédron 7a8c74f617 rabbitmq-dist.mk: Consider $TEST_DEPS when installing CLI (or not)
Follow-up to commit 0e5e25d961.
2020-03-06 12:41:08 +01:00
Jean-Sébastien Pédron 0e5e25d961 rabbitmq-dist.mk: Don't install CLI if the project dost not depend on `rabbit`
This is the case of rabbitmq-common and rabbitmq-amqp1.0-common for
instance.
2020-03-06 12:25:12 +01:00
Gerhard Lazu 46ef666075 Use dev prometheus.erl in RabbitMQ master (3.9.x)
We want to test PRs such as
https://github.com/deadtrickster/prometheus.erl/pull/102
in RabbitMQ master (3.9.x) so that we can test fixes against other
master components, like OTP 23 (erlang-git).

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2020-03-06 09:04:07 +00:00
Gerhard Lazu 8fb9ce1450 Merge pull request #359 from rabbitmq/erlang-mk-query-deps
Add erlang.mk query-deps
2020-03-06 09:01:13 +00:00
Gerhard Lazu 24eb242135 Add erlang.mk query-deps* family of targets
After checking out this branch, run the following command in the
umbrella:

    make update-erlang-mk

This will enable the following command across all RabbitMQ deps:

    make query-deps

And this is what the output for one such dependency looks like:

    pwd
    /Users/gerhard/github.com/rabbitmq/3.9.x/deps/rabbitmq_management

    make query-deps
    rabbitmq_management: ranch hex https://hex.pm/packages/ranch 1.7.1
    rabbitmq_management: rabbit_common git_rmq https://github.com/rabbitmq/rabbitmq-common master
    rabbitmq_management: rabbit git_rmq https://github.com/rabbitmq/rabbitmq-server master
    rabbitmq_management: amqp_client git_rmq https://github.com/rabbitmq/rabbitmq-erlang-client master
    rabbitmq_management: cowboy hex https://hex.pm/packages/cowboy 2.6.1
    rabbitmq_management: cowlib hex https://hex.pm/packages/cowlib 2.7.0
    rabbitmq_management: rabbitmq_web_dispatch git_rmq https://github.com/rabbitmq/rabbitmq-web-dispatch master
    rabbitmq_management: rabbitmq_management_agent git_rmq https://github.com/rabbitmq/rabbitmq-management-agent master
    rabbit_common: rabbitmq_codegen git_rmq https://github.com/rabbitmq/rabbitmq-codegen master
    rabbit_common: lager hex https://hex.pm/packages/lager 3.8.0
    rabbit_common: jsx hex https://hex.pm/packages/jsx 2.9.0
    rabbit_common: ranch hex https://hex.pm/packages/ranch 1.7.1
    rabbit_common: recon hex https://hex.pm/packages/recon 2.5.0
    rabbit_common: credentials_obfuscation hex https://hex.pm/packages/credentials_obfuscation 1.1.0
    lager: goldrush git https://github.com/DeadZen/goldrush.git 0.1.9
    rabbit: rabbitmq_cli git_rmq https://github.com/rabbitmq/rabbitmq-cli master
    rabbit: syslog git https://github.com/schlagert/syslog 3.4.5
    rabbit: cuttlefish hex https://hex.pm/packages/cuttlefish 2.2.0
    rabbit: ranch hex https://hex.pm/packages/ranch 1.7.1
    rabbit: lager hex https://hex.pm/packages/lager 3.8.0
    rabbit: rabbit_common git_rmq https://github.com/rabbitmq/rabbitmq-common master
    rabbit: ra git https://github.com/rabbitmq/ra.git master
    rabbit: sysmon_handler hex https://hex.pm/packages/sysmon_handler 1.2.0
    rabbit: stdout_formatter hex https://hex.pm/packages/stdout_formatter 0.2.2
    rabbit: recon hex https://hex.pm/packages/recon 2.5.0
    rabbit: observer_cli hex https://hex.pm/packages/observer_cli 1.5.3
    rabbitmq_cli: rabbit_common git_rmq https://github.com/rabbitmq/rabbitmq-common master
    rabbitmq_cli: observer_cli hex https://hex.pm/packages/observer_cli 1.5.3
    observer_cli: recon hex https://hex.pm/packages/recon 2.5.0
    cuttlefish: getopt hex https://hex.pm/packages/getopt 1.0.1
    cuttlefish: lager hex https://hex.pm/packages/lager 3.7.0
    ra: elvis_mk git https://github.com/inaka/elvis.mk.git master
    ra: aten hex https://hex.pm/packages/aten 0.5.3
    ra: gen_batch_server hex https://hex.pm/packages/gen_batch_server 0.8.2
    amqp_client: rabbit_common git_rmq https://github.com/rabbitmq/rabbitmq-common master
    cowboy: cowlib git https://github.com/ninenines/cowlib 2.7.0
    cowboy: ranch git https://github.com/ninenines/ranch 1.7.1
    rabbitmq_web_dispatch: rabbit_common git_rmq https://github.com/rabbitmq/rabbitmq-common master
    rabbitmq_web_dispatch: rabbit git_rmq https://github.com/rabbitmq/rabbitmq-server master
    rabbitmq_web_dispatch: cowboy hex https://hex.pm/packages/cowboy 2.6.1
    rabbitmq_management_agent: rabbit_common git_rmq https://github.com/rabbitmq/rabbitmq-common master
    rabbitmq_management_agent: rabbit git_rmq https://github.com/rabbitmq/rabbitmq-server master

re https://github.com/ninenines/erlang.mk/pull/875

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2020-03-05 15:10:37 +00:00
Jean-Sébastien Pédron cb432fd664 rabbitmq-tools.mk: Only update `.travis.yml` if branches match
... between the current project and rabbitmq-common.

Like with `rabbitmq-components.mk`, this avoids to use an incorrect copy
if the current project uses a different branch or does not have e.g. a
`v3.8.x` branch (unlike rabbitmq-common).
2020-03-04 16:15:48 +01:00
Jean-Sébastien Pédron 54e290683d Travis CI: Set $current_rmq_ref based on Travis variables
We need to communicate this information to rabbitmq-components.mk so it
selects the right branch for each dependency.

By default, it would query git(1), but after Travis clones and possibly
merges branches, it does not have access to the information anymore.
Forunately, the Travis environment has everything we need.

$base_rmq_ref was already set properly in a previous commit.

If Travis is building a tag, $TRAVIS_BRANCH will contain the appropriate
value, so this works in this case as well.

We now also check if `rabbitmq-components.mk` is up-to-date.
2020-03-04 13:32:57 +01:00
Jean-Sébastien Pédron ec93c7dce3 Travis CI: Ensure Elixir is installed
To do so, we set the language to Elixir, even though almost all our
projects are written in Erlang. But we need Elixir for the RabbitMQ CLI.

Specifying Elixir as the language in Travis allows us to:
1. make sure Elixir is installed by Travis
2. specify the versions of both Erlang/OTP and Elixir

We also set an explicit install step. Not that we care about `mix
local.hex`, but we need to override the default Travis install step
which assumes this is an Elixir (mix) based project.

We take this opportunity to add Erlang/OTP 22.2 to the build matrix.

While here, we bring two fixes:
* Warnings reported by Travis are solved: the OS is set explicitly and
  `sudo` is removed.
* The "git checkout" gymnastic is replaced by simply setting
  `$base_rmq_ref`. This is a better solution to make sure the
  appropriate dependencies' branch is selected.
2020-03-04 10:51:21 +01:00
Jean-Sébastien Pédron 5dc227a6eb rabbitmq-run.mk: Skip builds in `make run-broker NOBUILD=1`
This can allow for faster RabbitMQ startup time when we know there is
nothing to compile.
2020-03-03 18:33:46 +01:00
Jean-Sébastien Pédron 15c47804ec rabbitmq-tools.mk: Don't add .travis.yml is there none in the first place
One has to manually add it the first it is used in a project.
2020-03-03 18:32:48 +01:00
Michael Klishin 2305b23cd9 Avoid using erlang:get_stacktrace/0 for improved OTP 23/24 compat 2020-02-27 22:25:46 +03:00
Jean-Sébastien Pédron dea423ad36 rabbit_env: Add `$RABBITMQ_CONFIG_FILES`
It is used to specify additional configuration files when using the
Cuttlefish format.

[#171491267]
2020-02-26 15:35:57 +01:00
Jean-Sébastien Pédron 3aa7dd1adb rabbit_env: Add $RABBITMQ_{PRODUCT_NAME,PRODUCT_VERSION,MOTD_FILE}
They are used to override the product name and version, and expand the
banners which are printed and logged on startup.

[#170054940]
2020-02-20 17:48:54 +01:00
Jean-Sébastien Pédron 7638a5439f rabbitmq-run.mk: Set console log level to debug
Exactly as we previously set the file log level to debug.

Note that it does not enable logging on the console, it only changes the
default log level if the user of `make run-broker` enables console
logging (using `make run-broker RABBITMQ_LOGS=-`).

[#171131596]
2020-02-13 09:54:45 +01:00
Gerhard Lazu f80c456370 Bump prometheus.erl & observer_cli to latest
Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2020-02-11 15:57:23 +00:00
Jean-Sébastien Pédron ca844d994b Merge pull request #354 from rabbitmq/extract_sd_notify
Remove systemd_notify_socket
2020-02-10 15:24:33 +01:00
Michael Klishin cf52b22f37 Transitonal step for OTP 23 [master] compat 2020-02-09 23:47:46 +03:00
Michael Klishin 4be3ff3f14 rabbit_misc:sort_field_table/1: support map arguments
This is convenient when working with objects deserialised
from JSON definitions.
2020-02-08 01:22:10 +03:00
Philip Kuryloski bc7e8e19f2 Remove systemd_notify_socket
The env var is now handled directly by rabbitmq_prelaunch rabbit_boot_state_systemd
2020-02-07 10:46:17 +01:00
Jean-Sébastien Pédron 994d0d4116 rabbit_env_SUITE: Check if $RABBITMQ_FEATURE_FLAGS is overridden
This happens when testing mixed-versions cluster in CI. This fixes the
test after commit 23a0a07e3a.

[#170149339]
2020-02-04 15:19:37 +01:00
Jean-Sébastien Pédron 780dd0de40 rabbit_env: Set $RABBITMQ_ENABLED_PLUGINS to an empty string to disable all plugins
The previous value accepted for this behavior was "NONE". But it's more
intuitive to set it to nothing.

`rabbitmq-run.mk` is also updated to allow `$RABBITMQ_ENABLED_PLUGINS`
to be overriden e.g. on the command line.
2020-01-24 12:54:43 +01:00
Jean-Sébastien Pédron ad8dbdaed6 rabbit_nodes_common: New name_type/1 function
It guesses the node name type, based on the host part of a node name.
I.e., if it contains at least a `.` character, it's a longname.

This matches the verification `net_kernel` does to make sure the node
name corresponds to the shortnames/longnames option.
2020-01-22 12:05:15 +01:00
Jean-Sébastien Pédron 82192ad881 rabbit_env: Improve how we locate the plugins directory
There are two changes in this patch:

1. In `get_default_plugins_path_from_node(), we base the search on
   `rabbit_common.app` instead of `code:lib_dir(rabbit_common)`.
   The latter only works if the application directory is named
   `rabbit_common` or `rabbit_common-$version`. This is not the case
   with a default Git clone of the repository because the directory will
   be named `rabbitmq-common`.

   Using `rabbit_common.app` is fine because it is inside the `ebin`
   directory, as all modules. It also brings another benefit: it is not
   subject to cover-compilation or preloading (which both get rid of the
   original module location).

2. The code to determine the plugins directory based on the directory
   containing the module (or `rabbit_common.app`) now takes into account
   plugin directories (as opposed to .ez archives). In this case, there
   is one less path component compared to an .ez archive.
2020-01-21 14:50:07 +01:00
Jean-Sébastien Pédron 23a0a07e3a rabbit_env: Record variables' origin
I.e. we record the fact that a particular value:
  * is the default value, or
  * comes from an environment variable, or
  * comes from querying a remote node

This required a significant refactoring of the module, which explains
the large diff.

At the same time, the testsuite was extended to cover more code and
situations.

This work permits us to move remaining environment variables checked by
`rabbit` to this module. They include:
  * $RABBITMQ_LOG_FF_REGISTRY
  * $RABBITMQ_FEATURE_FLAGS
  * $NOTIFY_SOCKET

[#170149339]
2020-01-21 12:46:06 +01:00
Jean-Sébastien Pédron 972643a99d rabbit_env: Fix an error reported by Dialyzer
value_is_yes() is always called with a string as argument.
2020-01-21 12:02:54 +01:00
Jean-Sébastien Pédron 006c4f3895 rabbitmq-dist.mk: Don't install CLI when testing rabbitmq-common
We don't need the CLI in this case and this would be a dependency
circle: rabbitmq-common <- rabbitmq-cli <- rabbitmq-common.
2020-01-21 12:02:54 +01:00
Jean-Sébastien Pédron 6331123a54 include/rabbit.hrl: Plugins' dependencies are a list of atom()
... not a list of tuples.
2020-01-16 11:48:37 +01:00
Jean-Sébastien Pédron 96ffc4bc3b Sort feature_flags/federation log categories alphabetically 2020-01-13 18:37:07 +01:00
Jean-Sébastien Pédron 39064b3d64 Add `rabbit_log_feature_flags` log category 2020-01-13 17:01:27 +01:00
Jean-Sébastien Pédron 5e4d4af150 rabbit_misc: Add `rabbitmq_related_module_attributes/0`
Compared to `all_module_attributes/0`, it only scans applications which
are related to RabbitMQ: either a RabbitMQ core application or a plugin
(i.e. an application which depends on `rabbit`).

On my laptop, this significantly reduce the time to query module
attributes in the case of feature flags: it goes from 830 ms to 235 ms
just by skipping all Erlang/OTP applications are third-party
dependencies.

This makes a small improvement to RabbitMQ startup time, which is
visible for developers mainly, not for a production instance.
2020-01-13 16:59:07 +01:00
Michael Klishin 818362766d (c) bump
(cherry picked from commit 013ba83abcce06c52c12e2a41e728c1e2399be60)
2019-12-29 05:55:51 +03:00
Michael Klishin 4e5123c1de rabbit_writer state: gc_threshold => writer_gc_threshold, references #343 2019-12-24 23:40:42 +03:00
Michael Klishin d64dcc0a29 Bump default GC threshold to the same 1GB 2019-12-20 08:03:28 +03:00
Michael Klishin d5f67e1f9f Merge branch 'configurable_gc_threshold' of https://github.com/nyczol/rabbitmq-common into nyczol-configurable_gc_threshold 2019-12-20 03:34:11 +03:00
Jean-Sébastien Pédron 6ba6dd63f5 Merge pull request #344 from rabbitmq/lrb-mqtt-stomp-start-cluster
Add MQTT and STOMP port calc to start-cluster
2019-12-18 11:41:34 +01:00
Luke Bakken 101371778a Remove RABBITMQ_GENERATED_CONFIG_DIR
No longer applies after merge of rabbitmq/rabbitmq-server#2180
2019-12-16 11:00:12 -08:00
Jean-Sébastien Pédron e0ea1432ca rabbitmq-tools.mk: Add `sync-gitignore-from-master` helper
To be used in branches other than `master`. It will take `.gitignore`
from master and replace the current copy with it.

Like a few other targets, it supports `DO_COMMIT=yes` to commit the
change as well.
2019-12-13 14:40:59 +01:00
Luke Bakken edf8f892d4 Add MQTT and STOMP port calc to start-cluster 2019-12-12 07:35:38 -08:00
Jean-Sébastien Pédron 179d1657a8 rabbitmq-components.mk: Locate Umbrella relative to $(APPS_DIR)/my_app as well
When we are running Makefile recipes from an application under
`$(APPS_DIR)`, we want to locate the Umbrella correctly to:
- set `$(DEPS_DIR)` accordingly
- prevent `make distclean` from removing `$(DEPS_DIR)`

Before this change and after `rabbit/apps/rabbitmq_prelaunch` was added,
running `make distclean` in `rabbit` removed everything under
`$(DEPS_DIR)`.
2019-12-12 13:04:23 +01:00
Jean-Sébastien Pédron 0fb6f466e4 rabbit_env: Fix typo in comment about Dialyzer 2019-12-12 13:01:09 +01:00
Jean-Sébastien Pédron e5b3d45726 rabbit_env: Fix Dialyzer warnings
There was one legitimate warning in `get_enabled_plugins()`:
`get_prefixed_env_var()` already takes care of converting an empty
string to false.

The other warning is because `loading_conf_env_file_enabled()` returns a
boolean when compiled for tests, but always true when compiled for
production. Dialyzer only sees the second case and thinks the cases
where the function returns false will never happen.
2019-12-12 12:18:41 +01:00
ANycz e31131dca1 make garbage collector threshold configurable 2019-12-11 21:35:53 +01:00
Jean-Sébastien Pédron a7a305dca2 include/rabbit.hrl: Move Erlang/OTP required versions to `rabbitmq_prelaunch` 2019-12-11 14:45:39 +01:00
Jean-Sébastien Pédron 90d5c28445 rabbitmq-dist.mk: Empty `$(DIST_AS_EZS)` to distribute plugins as dirs
... instead of `.ez` archives.

The default is still to create `.ez` archives for all RabbitMQ
components & plugins.

However if `$(USE_RABBIT_BOOT_SCRIPT)` is set (experimental and
undocumented for now), they are distributed as directories.
2019-12-11 14:45:39 +01:00
Jean-Sébastien Pédron e2f4fc3e04 rabbitmq-run.mk: Don't run rabbitmq-plugins(8) to enable plugins
This is handled by the `rabbitmq_prelaunch` application now, based on
the value of `$RABBITMQ_ENABLED_PLUGINS`.

`$(RABBITMQ_ENABLED_PLUGINS_FILE)` depended on `dist`. This dependency
was moved to individual `run-*` and `start-*` targets.

While here, re-use `test-dist` instead of `dist` if the build was
already done for tests.

The testsuites default to run `make test-dist` as a first step.
Therefore later, when it starts a node, it should re-use that instead of
depending on `make dist` which will rebuild the tested project and
remove test dependencies from plugins.

This is useful (and mandatory in fact) now that `rabbit` is packaged
like plugins because, in the case of rabbitmq-erlang-client for
instance, the broker is a `$(TEST_DEPS)`: if starting a node runs `make
dist`, the broker will be removed.
2019-12-11 14:45:39 +01:00
Jean-Sébastien Pédron 12d48ff717 rabbitmq-dist.mk: Fix concurrent runs of `make {,test-}dist` and `make install-cli`
The fix depends on the presence of lockf(1) or flock(1).
2019-12-11 14:45:39 +01:00
Jean-Sébastien Pédron 5840834fa8 rabbitmq-dist.mk, rabbitmq-run.mk: Copy scripts & escripts
... to the plugin being worked on, instead of locating `rabbit` and
taking the scripts there.

It greatly simplifies the use of RabbitMQ and plugins inside a
development working copy because the layout is closer to what we would
have in a package. I.e. there are far less special cases.
2019-12-11 14:45:39 +01:00
Jean-Sébastien Pédron 405f86f39b rabbitmq-dist.mk: Create an .ez archive for `rabbit` too
The goal is to distribute RabbitMQ core (the `rabbit` Erlang
application) exactly as we distribute plugins. This simplifies the
startup script and CLI tools when we have to setup Erlang code search
path.
2019-12-11 14:45:39 +01:00
Jean-Sébastien Pédron 11c29bfb29 Add `rabbit_log_prelaunch` log category
While here, sort categories alphabetically and add missing ones to the
declared type().
2019-12-11 14:45:38 +01:00
Jean-Sébastien Pédron 77b655bc71 rabbit_env: New module to prepare context based on environment
... and default values.

It can also query a remote node for some specific values. The use case
is the CLI which should know what the RabbitMQ node it controls uses
exactly.

It supports several new environment variables:

  RABBITMQ_DBG:
    Used to setup `dbg` for some simple tracing scenarios.

  RABBITMQ_ENABLED_PLUGINS:
    Used to list plugins to enable automatically on node startup.

  RABBITMQ_KEEP_PID_FILE_ON_EXIT:
    Used to indicate if the PID file should be removed or kept when the
    node exits.

  RABBITMQ_LOG:
    Used to configure the global and per-category log levels and enable
    ANSI colors.
2019-12-11 14:45:35 +01:00
Jean-Sébastien Pédron 5b13de0927 rabbitmq-dist.mk: Ensure `make test-dist` is not always out-of-date
`ebin/test` is always touch(1)'d by Erlang.mk, which made the list of
dependencies of an .ez archive newer than the archive itself. This caused the
archive to be recreated.

While here, set `TEST_DIR` to something random in the case of `make
test-dist`: this way, rebuilding all testsuites is skipped by Erlang.mk.
Yes, this is a hack.
2019-12-05 14:54:16 +01:00
Jean-Sébastien Pédron ba498049ed rabbit_misc: Use PowerShell to check process aliveness on Windows
At least on the Windows Server 2019 AWS EC2 image, the `tasklist`
command is unavailable.

If that's the case, we fallback to using a PowerShell oneliner. It's not
the default, just in case PowerShell is unavailable.
2019-12-05 12:29:41 +01:00
Jean-Sébastien Pédron da3e784a7a rabbitmq-build.mk: Don't add Elixir lib dir to `$ERL_LIBS`
This is now done in xrefr (`mk/xrefr`) and rabbimq-ct-helpers when
needed.

This has several benefits:
  * This fixes `make run-broker` on Windows because the computed
    `$ERL_LIBS` was invalid there.
  * This saves a lot of Makefile processing time, because elixir(1) is
    quite slow to startup. On my laptop, a complete build in
    rabbitmq-server-release from 8.5 seconds to 3 seconds.
2019-12-05 12:29:30 +01:00
Michael Klishin 388f514e1a rabbit_misc:append_rpc_all_nodes/4: wrap non-list return values
into a list, as the function implies.

All current call sites use it to call functions that return lists.
However, rabbitmq/rabbitmq-cli#389 breaks this cycle.
2019-12-05 06:50:15 +03:00
Luke Bakken decd320133 Merge pull request #340 from rabbitmq/lrb-epmd-starter-tweak
epmd-starter improvements
2019-11-19 10:18:22 -08:00
Michael Klishin 5784240b99 Extract parse_bool/1 and parse_int/1 from rabbit_mgmt_util
A follow-up to rabbitmq/rabbitmq-management#749.
2019-11-19 19:10:48 +03:00
Michael Klishin 4361cd6ddf Merge pull request #339 from rabbitmq/rabbitmq-management-749
Move some helpers from rabbitmq-management
2019-11-19 02:27:13 +03:00
Luke Bakken b4b7549ad3 Special-case x-queue-type classic/undefined
Fixes #341
2019-11-15 13:33:43 -08:00
Luke Bakken 7eb5b3c5d5 epmd-starter improvements
* Use `noinput`
* Use `-s erlang halt` to skip small `eval` overhead
* Use `no_dot_erlang` boot file since we do not want user customizations to interfere
2019-11-14 10:40:44 -08:00
Michael Klishin 5aef852257 Move some helpers from rabbitmq-management
Part of rabbitmq/rabbitmq-management#749.
2019-11-12 03:07:14 +03:00
Michael Klishin d0384fabfe Merge branch 'master' into reserve-qq-file-handles 2019-10-24 11:57:40 +03:00
Yury.Alioshinov 80dc973aae add forgotten ldap type 2019-10-20 23:38:52 +03:00
Michael Klishin f03f4886c3 Naming 2019-10-17 00:07:42 +03:00
dcorbacho 2c56e75158 Reserve the 3 fixed ra file handles
[#169063174]
2019-10-16 10:44:21 +01:00
dcorbacho df0f34d1cb Reserve file handles for quorum queues
These should be taken into account into the limits, but always be granted.
Files must be reserved by the queues themselves using `set_reservation/0` or
`set_reservation/1`. This is an absolute reservation that increases or
decreases the number of files reserved to reach the given amount on every
call.

[#169063174]
2019-10-15 15:16:10 +01:00
Michael Klishin 6798bc3575 Make license line in startup banner more specific 2019-10-04 20:12:44 +03:00
Jean-Sébastien Pédron 2625f43086 rabbitmq-run.mk: Fix generated rabbitmq-server configuration
To configure the AMQP TCP listener, the key is `tcp_listeners`, not
`listeners`.
2019-09-13 13:47:16 +02:00
kjnilsson 353382c94e Change Ra dep back to git master
To more easily align RabbitMQ and Ra developement
2019-09-13 09:23:33 +01:00
kjnilsson 44d01eb9d0 update ra dep 2019-09-04 11:02:03 +01:00
Jean-Sébastien Pédron ad52a23bb5 rabbitmq-run.mk: Set $RABBITMQ_BASE
Otherwise on Windows, the broker may read system files: this would
pollute the test environment.
2019-09-03 18:14:38 +02:00
Jean-Sébastien Pédron 3dd58ae12a rabbitmq-run.mk: Bump `rabbitmqctl wait` timeout from 10 to 60 seconds
... when we wait for a node started in the background.

This helps when the PID is written asynchronously by the Erlang node
instead of the rabbitmq-server(8) script: in this case, the `rabbitmqctl
wait` command may start to wait earlier in the former situation than the
latter one, and thus timeout earlier.
2019-09-03 18:10:48 +02:00
Jean-Sébastien Pédron f6780f1bec rabbitmq-dist.mk: Sort files inside the .ez archives
This helps with reproducible builds.
2019-09-03 18:10:39 +02:00
Jean-Sébastien Pédron bb5022ccec rabbitmq-dist.mk: Ensure rsync(1) arg is a Unix-like path
On Windows, if we pass it a Windows-native path like `C:\User\...` or
even something with forward slashes, rsync(1) will consider that `C`
(before the colon) is a hostname and it should try to connect to it.

Using `cygpath.exe` on Windows converts the Windows path to a Unix-like
one (e.g. `/c/Users/...`).
2019-09-03 12:02:20 +02:00
Michael Klishin c5df5043e9 rabbit_types:vhost/0 now delegates to vhost:name/0
[#166298298]
2019-08-30 10:58:34 +02:00
Diana Corbacho b94e01c90c The vhost record moved to a versioned record in rabbitmq-server
Add metadata to virtual hosts

[#166298298]

rabbit_vhost: use record defaults

The vhost record moved to a versioned record in rabbitmq-server

Co-Authored-By: Michael Klishin <mklishin@pivotal.io>
2019-08-30 10:19:50 +02:00
Jean-Sébastien Pédron a1fb3fcc37 Update erlang.mk 2019-08-29 20:44:37 +02:00
Michael Klishin 735c47eca9 Depend on credentials_obfuscation 1.1.0 2019-08-20 13:21:40 +10:00
Michael Klishin 91dd7dd1ab A typo 2019-08-20 13:13:07 +10:00
Michael Klishin b4990145de Use credentials_obfuscation from Hex 2019-08-20 13:10:07 +10:00
Michael Klishin b7f3114ebd Merge pull request #334 from rabbitmq/optimise-erlang-timers
Replace timer:send_after/3 by erlang:send_after/3
2019-08-17 08:45:29 +10:00
Michael Klishin 485888bbcd Switch to eunit macros for assertions 2019-08-17 05:47:42 +10:00
codeadict 5fb17b0943 Add stop{1,3} functions to gen_server2
These functions utilize proc_lib:stop, which in turn utilizes sys:terminate.

They were introduced in
9d7d1207ff.

Closes: #266
2019-08-16 12:14:48 -04:00
Diana Corbacho b580595ea4 Replace timer:send_after/3 by erlang:send_after/3
[#167926549]
2019-08-16 15:29:38 +01:00
Michael Klishin 65675b5f1f Merge pull request #332 from rabbitmq/rabbitmq-erlang-client-123-crypted-password-in-state
Enable credential obfuscation
2019-08-16 12:14:33 +10:00
Jean-Sébastien Pédron 57c14b1214 rabbitmq-{build,run,tools}.mk: Pass several variables to sub-makes
This saves a lot of time because:
1. we don't spawn a shell each time to compute the same value;
2. elixir(1) has a long startup time.

In my tests, a no-op gmake in `rabbit` goes from 2.5 seconds to 0.9
seconds.
2019-08-14 11:29:07 +02:00
Jean-Sébastien Pédron 79d7969c16 rabbitmq-run.mk: No need to find erl_call(1)
We don't use it anymore in the Makefiles. This speeds up the build
because we don't spawn a shell for something useless in the end.
2019-08-14 11:27:06 +02:00
Jean-Sébastien Pédron 16b702e0ca rabbitmq-run.mk: Use GNU Make functions to prepare $(DIST_ERL_LIBS)
... instead of Unix commands and a one-liner which assumes that `:` is
the path separator. This speeds up the build because we don't spawn a
shell.

While here, also remove `$(APPS_DIR)` from `$(ERL_LIBS)`.
2019-08-14 11:25:27 +02:00
Arnaud Cogoluègnes e4a935c49f Use credentials obfuscation application
rabbit_pbe is now delegating calls to the credentials obfuscation
app/library.

[#167070941]

References rabbitmq/rabbitmq-erlang-client#123
2019-08-13 09:50:25 +02:00
Arnaud Cogoluègnes dceeee8e31 Merge branch 'master' into rabbitmq-erlang-client-123-crypted-password-in-state 2019-08-12 14:02:09 +02:00
Michael Klishin 407cbfd503 Bump Lager to 3.8.0 2019-08-11 01:47:34 +10:00
Jean-Sébastien Pédron 0b20c2dd6b rabbitmq-tools.mk: Fix tags counting in `commits-since-release`
We have to apply the same tag filtering when counting them as the one
done by git-describe(1).

This fixes the following error:

    fatal: No names found, cannot describe anything

This issue was hit when there were tags in the project, but they were
all filtered out by git-describe(1).
2019-08-09 11:00:15 +02:00
Jean-Sébastien Pédron 205042d593 Update erlang.mk 2019-08-02 09:53:18 +02:00
Michael Klishin f2e147b025 Bump observer_cli and sysmon_handler deps 2019-08-01 17:11:57 +03:00
Arnaud Cogoluègnes 9f98340fd2 Add credentials obfuscation module
WIP, the secret is hardcoded, which is obviously not secured. It is
enough though to see if modules/applications manipulating credentials
can use it to avoid those credentials to end up in logs when the state
of crashed processes is dumped.

[#167070941]

References rabbitmq/rabbitmq-erlang-client#123
2019-07-29 16:09:40 +02:00
Jean-Sébastien Pédron 4af40e2d25 rabbitmq-run.mk: Compute MQTT and STOMP TCP ports for `run-broker`
They are based on `$(RABBITMQ_NODE_PORT)`, like the management plugin's
computed port.
2019-07-26 13:20:57 +02:00
Arnaud Cogoluègnes d01011d0f5 rabbitmq-tools.mk: Handle RabbitMQ components without tags
... in `commits-since-release`.

Before this change, the script was expecting at least one tag so that
git-describe(1) worked. Without that, it would fail with:

fatal: No names found, cannot describe anything.

Now, if a component has no tag, it will display "New in this release!".

Patch from @dumbbell
2019-07-12 16:53:05 +02:00
Arnaud Cogoluègnes b9a7be7e64 Add OAuth 2 plugin to rabbitmq-components.mk 2019-07-09 16:04:48 +02:00
Arnaud Cogoluègnes 80c8a09c3b Merge pull request #331 from rabbitmq/oauth2-credential-expiration-support
Support client-driven refresh of expiring credentials
2019-07-04 10:57:24 +02:00
Jean-Sébastien Pédron ed3dba3670 rabbitmq-dist.mk: Don't assume the plugin lives in `$(DEPS_DIR)`
The application to "package" as a plugin (an .ez archive) might be under
`$(APPS_DIR)`. Therefore now, the all the variables and recipes are
created from the path to the application not just its name.
2019-07-01 14:41:53 +02:00
Arnaud Cogoluègnes 55e7881c4a Merge branch 'master' into oauth2-credential-expiration-support 2019-07-01 11:42:37 +02:00
Jean-Sébastien Pédron e887709ada rabbitmq-dist.mk: Exclude `ebin/dep_built` from the files to distribute in plugins
This file is useful at build time only (for Erlang.mk) and it breaks the
build of the .ez archive otherwise.
2019-06-28 23:48:43 +02:00
Jean-Sébastien Pédron 8d1e9ce40a Update erlang.mk 2019-06-28 16:01:30 +02:00
Jean-Sébastien Pédron 095294be04 rabbitmq-components.mk: Force rebuild of all RabbitMQ components
With the update of Erlang.mk, dependencies are not rebuilt anymore by
default, except if `FULL=1` is set.

This behavior is not adapted to the work on RabbitMQ where many
components are split into many repositories, and we work on several of
them at the same time.

Therefore, the idea of this commit is to tell Erlang.mk to always visit
dependencies which are RabbitMQ components. Other dependencies are only
built once the first time.

[#166980833]
2019-06-28 15:54:23 +02:00
Jean-Sébastien Pédron 89a188c4e9 rabbitmq-mix.mk: Moved to rabbitmq-server-release 2019-06-26 18:49:40 +02:00
Jean-Sébastien Pédron f12002e2f3 rabbitmq-*test.mk: Fix latest regressions on our side w.r.t *-on-concourse
Unfortunately, the *-on-concourse targets still don't work: fly(1), the
Concourse CLI, looks to have regressed even more: it doesn't upload all
inputs. Half of them are just empty directories.

Obviously, compiling anything fails because if this.
2019-06-25 18:23:54 +02:00
Michael Klishin 10b4cb1c48 WIP: credential expiration support prototyping 2019-06-22 18:40:01 +03:00
D Corbacho 683bed4802 Merge pull request #329 from rabbitmq/rabbitmq-server-2030
Make default worker pool size configurable
2019-06-13 15:14:43 +01:00
Michael Klishin 29c933a4cd Make default worker pool size configurable
Part of rabbitmq/rabbitmq-server#2030.
2019-06-13 16:55:16 +03:00
Michael Klishin dd6e521204 New Lager sink for Shovel
References rabbitmq/rabbitmq-shovel#60.

[#166627333]
2019-06-12 18:33:21 +03:00
Michael Klishin cb42235776 Merge branch 'master' into rabbitmq-server-1767-protocol-specific-ctx-in-authn-authz 2019-06-07 19:53:26 +03:00
Gerhard Lazu a4b5953d78 Update rabbitmq-components.mk 2019-06-03 02:24:18 +01:00
Arnaud Cogoluègnes a930be7489 Modify authz to propagate protocol-specific context
References rabbitmq/rabbitmq-server#1767
2019-05-29 10:35:48 +02:00
Jean-Sébastien Pédron 6b16a1f2f5 rabbitmq-components.mk: Take observer_cli from Hex.pm 2019-05-17 15:17:48 +02:00
Michael Klishin b4feede8b2 observer_cli 1.5.0 2019-05-17 08:38:02 +03:00
Michael Klishin ef0d843ba5 Bump Recon 2.5.0 for Erlang 22 compat, depend on our fork of observer_cli that uses it 2019-05-16 23:22:26 +03:00
Michael Klishin 8ff556bde2 Depend on observer_cli 1.4.5 2019-05-14 11:46:38 +03:00
Michael Klishin 69598d36fb rabbitmq-components.mk: add observer_cli dependency
For rabbitmq/rabbitmq-cli#353 and rabbitmq/rabbitmq-server#2006.
2019-05-13 16:40:02 +03:00
Gerhard Lazu 05b3f9dedd Fix start-brokers / start-cluster make target
`-ra data_dir` is not necessary. It was also missing a \
2019-05-09 18:02:14 +01:00
Gerhard Lazu df416530ce Update prometheus to v4.3.0 to benefit from global_labels
deadtrickster/prometheus.erl#91
2019-05-01 13:13:58 +01:00
Luke Bakken 70d2020f81 Update rabbitmq-components.mk 2019-04-30 16:22:59 -07:00
Jean-Sébastien Pédron a0a044ce5e rabbit_pretty_stdout: Remove module
It was replaced by the external library, `stdout_formatter`, which is
based on this module.

[#164931055]
2019-04-30 14:33:27 +02:00
Jean-Sébastien Pédron 72cb6bbe6d rabbitmq-components.mk: Pin stdout_formatter version to 0.2.2
[#164931055]
2019-04-30 14:28:46 +02:00
Michael Klishin 9eb9686795 Merge branch 'master' into rabbitmq-erlang-client-91 2019-04-25 21:10:36 +03:00
Daniil Fedotov e9cd793eb4 Move rabbit_queue_collector to rabbit_common repo.
Collector is used by a connection supervisor, which may be on
the client side for direct connections.

Addresses rabbitmq-erlang-client#91
2019-04-23 16:47:23 -04:00
Michael Klishin a8495e1c30 channel_exchange_metrics now has one more metric: dropped unroutable messages
Part of rabbitmq/rabbitmq-server#1904.

[#165548314]
2019-04-23 23:22:58 +03:00
Gerhard Lazu 3bed6894d7 Merge branch 'rabbitmq-prometheus'
[#164376052]
2019-04-22 21:51:47 +01:00
Jean-Sébastien Pédron b0b2963023 rabbit_pbe: Default cipher's name depends on Erlang version
In Erlang 22, the name is now `aes_256_cbc`.

The default cipher/hash/iterations are also set in rabbit's application
default environment. I'm going to remove those default values there
because the code already queries this module if they are missing from
the application environment.
2019-04-19 16:03:52 +02:00
Jean-Sébastien Pédron 3d93ed3d90 rabbit_pbe: Use the new `crypto:supports/1` function in Erlang 22
This fixes a crash of the call to `crypto:cipher_info/1` later because
the ciphers list returned by `crypto:supports/0` contains more ciphers:
"old aliases" are added to that list and those aliases are unsupported
by `crypto:cipher_info/1`.
2019-04-19 11:28:40 +02:00
Michael Klishin 39528ba08b rabbit_misc: introduce rabbitmq_and_erlang_versions/0
Combines version/0 and otp_release/0 so that both can be retrieved
by rabbitmqctl cluster_status in one shot.
2019-04-19 04:10:42 +03:00
Gerhard Lazu fbe2ac4cdb Allow RABBITMQ_CONFIG_FILE make variable to be overwritten 2019-04-17 13:27:31 +01:00
Michael Klishin 6adeb6a220 rabbit_resource_monitor_misc:parse_information_unit/1: coerce input to a list
Elixir passes them in as Erlang binaries.
2019-04-16 17:10:02 +04:00
Michael Klishin a66df54b1a Revert "Clarify"
This reverts commit 7c9f170cee.

CLI tools cannot use this function as it logs errors.
`rabbit_resource_monitor_misc:parse_information_unit/1` is a better fit.
2019-04-16 16:11:22 +04:00
Michael Klishin 7c9f170cee Clarify 2019-04-16 16:02:10 +04:00
Gerhard Lazu 0e7a68cfc9 Add rabbitmq_prometheus dep
[#164376052]
2019-04-16 12:06:44 +01:00
Jean-Sébastien Pédron 052697a3e7 Merge pull request #323 from rabbitmq/blacklist-tls1.3-until-client-implementation-is-finished
rabbit_ssl_options: Blacklist TLS 1.3 until Erlang client implementation is finished
2019-04-11 14:11:58 +02:00
Jean-Sébastien Pédron 858bd20704 rabbit_ssl_options: Blacklist TLS 1.3 until Erlang client implementation is finished
Erlang 22 will introduce TLS 1.3, but at the time of this commit, only
the server side is implemented. If the Erlang client requests TLS 1.3, the
server will accept but the client will either hang or crash.

So for now, just blacklist TLS 1.3 to avoid any issues, even on the
server side, just to be safe.

[#165214130]
2019-04-11 14:02:52 +02:00
Loïc Hoguin 1755b82ca1 Don't support aes_ctr ciphers until OTP-22+ 2019-04-09 12:21:12 +02:00
Jean-Sébastien Pédron b90088f63c rabbit_misc: Generate a `NEW_PID_EXT`-based binary in compose_pid/4
The `creation` field might not fit into one byte which makes the
`PID_EXT` format unsuitable for this case.

The `NEW_PID_EXT` format is supported since Erlang 19.0, so it is safe
to always use it, no matter the value of `creation`, because RabbitMQ
3.7+ requires at least Erlang 19.3+.

References #313.
2019-04-08 11:35:31 +02:00
Michael Klishin f90e81610f Merge pull request #319 from rabbitmq/rabbit-common-318
Handle missing getconf command
2019-04-03 08:43:11 +03:00
Luke Bakken affc3b3991 Handle missing getconf command
Previous behavior is to crash, this is more forgiving

Fixes #318
2019-04-02 10:09:39 -07:00
Loïc Hoguin d077ea6a20 Support both PID_EXT and NEW_PID_EXT simultaneously 2019-04-02 14:23:04 +02:00
Michael Klishin 35cf0b48c3 Merge pull request #311 from rabbitmq/rabbitmq-auth-backend-cache-20
Cache vhost access requests using client IP address only
2019-04-01 02:29:07 +03:00
Jean-Sébastien Pédron d8dd5c623a Merge pull request #316 from rabbitmq/lxv-vm-memory-monitor-fix
vm_memory_monitor: handle KB as well as kB
2019-03-29 14:08:16 +01:00
kjnilsson c206aa0819 vm_memory_monitor: handle KB as well as kB
There are cases (e.g. inside LXC) where the unit reported in /proc/meminfo uses
KB instead of kB. Handle this case.
2019-03-29 11:12:47 +00:00
Michael Klishin 49b02019eb Dialyzer: disable no_match for decompose_pid/1
which has code matching on a constant conditional to OTP version.

Follow-up to #313.
2019-03-26 15:25:56 +03:00
Loïc Hoguin c0d58226c5 We don't support aes_ctr before OTP-22
The cipher was not available via the EVP interface before
Erlang/OTP-22.
2019-03-26 10:55:56 +01:00
Michael Klishin 16d4e55d90 Merge branch 'master' into new_pid_ext-otp22 2019-03-26 11:56:19 +03:00
Michael Klishin 42b8c32cf5 Merge pull request #308 from rabbitmq/improve-rabbit-pbe-otp22
Make rabbit_pbe work for OTP-22
2019-03-26 11:56:01 +03:00
Michael Klishin 774d92cc00 gen_server2: don't emit deprecation warnings on OTP 22
This is a transitional step to get rabbit_common to compile
on OTP 22.
2019-03-26 11:52:29 +03:00
Loïc Hoguin a35d8567b0 Support the NEW_PID_EXT format introduced in OTP-22
In OTP-22 the Creation field has been increased to be 32 bits.
For now we only need to handle it when using term_to_binary
and parsing the result manually.
2019-03-26 08:59:57 +01:00
Luke Bakken 1789c5fc5c Update authz_data type to include binaries 2019-03-25 14:46:52 -07:00
Luke Bakken 7889ad3425 Finish converting check_vhost_access/3 to new API 2019-03-22 13:10:27 -07:00
Luke Bakken a4767a772a Modify check_vhost_access/3 to use map of data
Part of rabbitmq/rabbitmq-auth-backend-cache#20
2019-03-22 07:21:59 -07:00
Jean-Sébastien Pédron 0d0cbadf6b rabbitmq-hexpm.mk: Always download the latest hexpm-cli
As of this commit, it should still be version 0.3.0.
2019-03-21 15:51:08 +01:00
Michael Klishin fb44b03d3b Update test expectations to match the change in 882876297b 2019-03-20 12:22:02 +03:00
Spring Operator 882876297b URL Cleanup
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# HTTP URLs that Could Not Be Fixed
These URLs were unable to be fixed. Please review them to see if they can be manually resolved.

* http://blog.listincomprehension.com/search/label/procket (200) with 1 occurrences could not be migrated:
   ([https](https://blog.listincomprehension.com/search/label/procket) result ClosedChannelException).
* http://dozzie.jarowit.net/trac/wiki/TOML (200) with 1 occurrences could not be migrated:
   ([https](https://dozzie.jarowit.net/trac/wiki/TOML) result SSLHandshakeException).
* http://dozzie.jarowit.net/trac/wiki/subproc (200) with 1 occurrences could not be migrated:
   ([https](https://dozzie.jarowit.net/trac/wiki/subproc) result SSLHandshakeException).
* http://e2project.org (200) with 1 occurrences could not be migrated:
   ([https](https://e2project.org) result AnnotatedConnectException).
* http://erlang.org/doc/apps/erts/erl_ext_dist.html (200) with 1 occurrences could not be migrated:
   ([https](https://erlang.org/doc/apps/erts/erl_ext_dist.html) result ConnectTimeoutException).
* http://erlang.org/doc/man/erlang.html (200) with 1 occurrences could not be migrated:
   ([https](https://erlang.org/doc/man/erlang.html) result ConnectTimeoutException).
* http://nitrogenproject.com/ (200) with 2 occurrences could not be migrated:
   ([https](https://nitrogenproject.com/) result ConnectTimeoutException).
* http://proper.softlab.ntua.gr (200) with 1 occurrences could not be migrated:
   ([https](https://proper.softlab.ntua.gr) result SSLHandshakeException).
* http://yaws.hyber.org (200) with 1 occurrences could not be migrated:
   ([https](https://yaws.hyber.org) result AnnotatedConnectException).
* http://choven.ca (503) with 1 occurrences could not be migrated:
   ([https](https://choven.ca) result ConnectTimeoutException).

# Fixed URLs

## Fixed But Review Recommended
These URLs were fixed, but the https status was not OK. However, the https status was the same as the http request or http redirected to an https URL, so they were migrated. Your review is recommended.

* http://fixprotocol.org/ (301) with 1 occurrences migrated to:
  https://fixtrading.org ([https](https://fixprotocol.org/) result SSLHandshakeException).
* http://erldb.org (UnknownHostException) with 1 occurrences migrated to:
  https://erldb.org ([https](https://erldb.org) result UnknownHostException).
* http://host (UnknownHostException) with 1 occurrences migrated to:
  https://host ([https](https://host) result UnknownHostException).
* http://host:port/foo (UnknownHostException) with 2 occurrences migrated to:
  https://host:port/foo ([https](https://host:port/foo) result UnknownHostException).
* http://www.cs.indiana.edu/~burger/fp/index.html (301) with 1 occurrences migrated to:
  https://cs.indiana.edu/~burger/fp/index.html ([https](https://www.cs.indiana.edu/~burger/fp/index.html) result 404).

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* http://cloudi.org/ with 27 occurrences migrated to:
  https://cloudi.org/ ([https](https://cloudi.org/) result 200).
* http://en.wikipedia.org/wiki/X86-64 with 1 occurrences migrated to:
  https://en.wikipedia.org/wiki/X86-64 ([https](https://en.wikipedia.org/wiki/X86-64) result 200).
* http://erlware.org/ with 1 occurrences migrated to:
  https://erlware.org/ ([https](https://erlware.org/) result 200).
* http://inaka.github.io/cowboy-trails/ with 1 occurrences migrated to:
  https://inaka.github.io/cowboy-trails/ ([https](https://inaka.github.io/cowboy-trails/) result 200).
* http://lukego.livejournal.com/6753.html with 1 occurrences migrated to:
  https://lukego.livejournal.com/6753.html ([https](https://lukego.livejournal.com/6753.html) result 200).
* http://ninenines.eu with 6 occurrences migrated to:
  https://ninenines.eu ([https](https://ninenines.eu) result 200).
* http://semver.org/ with 1 occurrences migrated to:
  https://semver.org/ ([https](https://semver.org/) result 200).
* http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html with 1 occurrences migrated to:
  https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html ([https](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) result 200).
* http://www.actordb.com/ with 2 occurrences migrated to:
  https://www.actordb.com/ ([https](https://www.actordb.com/) result 200).
* http://www.cs.kent.ac.uk/projects/wrangler/Home.html with 1 occurrences migrated to:
  https://www.cs.kent.ac.uk/projects/wrangler/Home.html ([https](https://www.cs.kent.ac.uk/projects/wrangler/Home.html) result 200).
* http://www.erlang.org/ with 2 occurrences migrated to:
  https://www.erlang.org/ ([https](https://www.erlang.org/) result 200).
* http://www.mail-archive.com/asn1@asn1.org/msg00460.html with 1 occurrences migrated to:
  https://www.mail-archive.com/asn1@asn1.org/msg00460.html ([https](https://www.mail-archive.com/asn1@asn1.org/msg00460.html) result 200).
* http://www.rabbitmq.com/ with 2 occurrences migrated to:
  https://www.rabbitmq.com/ ([https](https://www.rabbitmq.com/) result 200).
* http://www.rabbitmq.com/amqp-0-9-1-errata.html with 1 occurrences migrated to:
  https://www.rabbitmq.com/amqp-0-9-1-errata.html ([https](https://www.rabbitmq.com/amqp-0-9-1-errata.html) result 200).
* http://www.rabbitmq.com/memory.html with 1 occurrences migrated to:
  https://www.rabbitmq.com/memory.html ([https](https://www.rabbitmq.com/memory.html) result 200).
* http://www.rebar3.org with 1 occurrences migrated to:
  https://www.rebar3.org ([https](https://www.rebar3.org) result 200).
* http://code.google.com/p/clink/issues/detail?id=141 with 1 occurrences migrated to:
  https://code.google.com/p/clink/issues/detail?id=141 ([https](https://code.google.com/p/clink/issues/detail?id=141) result 301).
* http://contributor-covenant.org with 1 occurrences migrated to:
  https://contributor-covenant.org ([https](https://contributor-covenant.org) result 301).
* http://contributor-covenant.org/version/1/3/0/ with 1 occurrences migrated to:
  https://contributor-covenant.org/version/1/3/0/ ([https](https://contributor-covenant.org/version/1/3/0/) result 301).
* http://inaka.github.com/apns4erl with 1 occurrences migrated to:
  https://inaka.github.com/apns4erl ([https](https://inaka.github.com/apns4erl) result 301).
* http://inaka.github.com/edis/ with 1 occurrences migrated to:
  https://inaka.github.com/edis/ ([https](https://inaka.github.com/edis/) result 301).
* http://lasp-lang.org/ with 1 occurrences migrated to:
  https://lasp-lang.org/ ([https](https://lasp-lang.org/) result 301).
* http://msdn.microsoft.com/en-us/library/aa366778 with 1 occurrences migrated to:
  https://msdn.microsoft.com/en-us/library/aa366778 ([https](https://msdn.microsoft.com/en-us/library/aa366778) result 301).
* http://msdn.microsoft.com/en-us/library/bb540814 with 1 occurrences migrated to:
  https://msdn.microsoft.com/en-us/library/bb540814 ([https](https://msdn.microsoft.com/en-us/library/bb540814) result 301).
* http://rabbitmq.com/documentation.html with 1 occurrences migrated to:
  https://rabbitmq.com/documentation.html ([https](https://rabbitmq.com/documentation.html) result 301).
* http://saleyn.github.com/erlexec with 1 occurrences migrated to:
  https://saleyn.github.com/erlexec ([https](https://saleyn.github.com/erlexec) result 301).
* http://www.erlang.org/doc/system_principles/versions.html with 1 occurrences migrated to:
  https://www.erlang.org/doc/system_principles/versions.html ([https](https://www.erlang.org/doc/system_principles/versions.html) result 301).
* http://www.mozilla.org/MPL/ with 66 occurrences migrated to:
  https://www.mozilla.org/MPL/ ([https](https://www.mozilla.org/MPL/) result 301).
* http://zhongwencool.github.io/observer_cli with 1 occurrences migrated to:
  https://zhongwencool.github.io/observer_cli ([https](https://zhongwencool.github.io/observer_cli) result 301).
2019-03-20 03:13:48 -05:00
Michael Klishin 9f6d2b449f Require Erlang 21.3 2019-03-20 10:24:51 +03:00
Loïc Hoguin 944f0087bf Make rabbit_pbe work for OTP-22 2019-03-19 15:02:24 +01:00
Jean-Sébastien Pédron 3eb5ae110a rabbitmq-hexpm.mk: Switch to hexpm-cli 0.3.0
This version should work with the latest `rebar3_hex` plugin (6.5.0).
2019-03-18 13:40:25 +01:00
Jean-Sébastien Pédron 844c591027 Revert "rabbitmq-run.mk: Increase lager message rate threshold from 50 to 5000"
We don't need this anymore, now that the high watermark is bumped
automatically when the log level is set to `debug` in rabbit_lager.

This reverts commit 49956c6423.
2019-03-18 11:41:28 +01:00
Michael Klishin 80c867763d Recon 2.4.0
[#164450566]
2019-03-15 05:32:16 +03:00
Michael Klishin cdf2a5afc0 Lager 3.6.9
[#164603900]
2019-03-15 05:17:19 +03:00
kjnilsson 1e6fed8e4e Replace use of erl_call with rabbitmqctl
The stop-node command is the only make target still using erl_call who
is prone to breakage (broken in OTP 21.3) and can readily be replaced
with rabbitmqctl stop.
2019-03-14 15:26:24 +00:00
Jean-Sébastien Pédron 517e1ff45c rabbit_pretty_stdout: Honor the `UseColors` flag in `*_table()`
To fix this, introduce a new helper, `ascii_color/2`, which takes a the
same flag (`UseColors`) as its second argument. If that flag is false,
it returns an empty string.

While here, move the `isatty()` function in this module.
2019-03-01 15:53:56 +01:00
Jean-Sébastien Pédron d216e67183 rabbitmq-run.mk: Set `$LEAVE_PLUGINS_DISABLED` to start broker without plugins
I.e, plugins are available but left disabled at broker start. It is
still possible to enable them using rabbitmq-plugins(1).
2019-03-01 15:52:38 +01:00
Jean-Sébastien Pédron ef6aa904c9 rabbitmq-run.mk: Allow to set `$RABBITMQ_PLUGINS_DIR` when starting a broker 2019-03-01 15:50:14 +01:00
Loïc Hoguin 9501caaf12 Fix rabbit_pbe for OTP-22
Some new ciphers have been added. Others will be added once
crypto exposes an interface to get cipher information.
2019-02-27 17:07:42 +01:00
Michael Klishin d8079705e2 Introduce rabbit_runtime:gc_all_processes/0 2019-02-21 19:10:57 +03:00
Michael Klishin 6736eb3629 Try to make node name mismatch message clearer, provide a hint
Per recent rabbitmq-users feedback.
2019-02-20 01:27:30 +03:00
Michael Klishin a14097173b Fix a typo in rabbitmq-components.mk 2019-02-12 22:34:01 +03:00
Michael Klishin dce6094507 Merge branch 'spelling' of https://github.com/jsoref/rabbitmq-common into jsoref-spelling 2019-02-12 22:33:25 +03:00
Daniil Fedotov 1dfb335217 Bump erlang version requirement.
RabbitMQ depends on `ra`, which uses persistent_term, only available in 21.2
2019-02-12 10:26:38 -05:00
Josh Soref 75d372c427 spelling: synchronization 2019-02-12 00:21:44 -05:00
Josh Soref 3874970790 spelling: subsequently 2019-02-12 00:21:30 -05:00
Josh Soref 2b33b0bb30 spelling: significant 2019-02-12 00:20:34 -05:00
Josh Soref 808cd4584b spelling: requests 2019-02-12 00:18:15 -05:00
Josh Soref 4a6db60311 spelling: registered 2019-02-12 00:17:40 -05:00
Josh Soref a86a748ae7 spelling: protocol 2019-02-12 00:16:34 -05:00
Josh Soref cceee735c3 spelling: originally 2019-02-12 00:15:43 -05:00
Josh Soref 5fd7ff1b9b spelling: occurring 2019-02-12 00:00:36 -05:00
Josh Soref 41d90889f9 spelling: messages 2019-02-12 00:14:01 -05:00
Josh Soref d741ee8630 spelling: javascript 2019-02-12 00:12:43 -05:00
Josh Soref c094d03324 spelling: implicitly 2019-02-12 00:11:55 -05:00
Josh Soref 5c9d996190 spelling: grammar 2019-02-12 00:10:49 -05:00
Josh Soref bf0b7560ed spelling: function 2019-02-12 00:09:37 -05:00
Josh Soref cf4be045c1 spelling: explicitly 2019-02-12 00:08:51 -05:00
Josh Soref eeb4f2150f spelling: during 2019-02-12 00:07:18 -05:00
Josh Soref 7bdd37a393 spelling: chosen 2019-02-12 00:04:24 -05:00
Josh Soref dc8988d366 spelling: asynchronous 2019-02-12 00:02:25 -05:00
Josh Soref fe1f2a3250 spelling: aggregator 2019-02-12 00:01:34 -05:00
Josh Soref f01c794511 spelling: additional 2019-02-12 00:01:01 -05:00
Michael Klishin 49a57986cd Merge pull request #301 from Haster2004/add-lager-sink-for-ldap
Add lager sink for ldap
2019-02-08 04:44:30 +03:00
Yury.Alioshinov a3d44e3fe4 fix whitespaces 2019-02-08 01:51:20 +03:00
Yury.Alioshinov 0e1e260446 rabbit_log_ldap external sink was added 2019-02-08 01:42:11 +03:00
Arnaud Cogoluègnes c8726cf2ac Handle empty binary payload when delivering message
Fixes #299
2019-02-07 14:47:50 +01:00
Loïc Hoguin a1b8b8fbbc Fix many Dialyzer warnings 2019-02-05 16:31:14 +01:00
kjnilsson 5d8cfdc134 Rename rabbit_log_ra
and add new sink to rabbitmq-build.mk

[#163724857]
2019-02-05 11:52:28 +00:00
Jean-Sébastien Pédron 9613cfafe0 Fix errors reported by Dialyzer
In particular, we drop support for Erlang R13B and older in
`rabbit_cert_info`. This fixes an error reported by Dialyzer now that
the list of dependencies (`$(LOCAL_DEPS)`) is more correct.
2019-02-01 10:45:30 +01:00
Jean-Sébastien Pédron 16d171c26d Makefile: Add missing dependencies to `$(LOCAL_DEPS)`
Dialyzer reports less missing types and unknown functions.
2019-02-01 10:45:29 +01:00
Jean-Sébastien Pédron 49956c6423 rabbitmq-run.mk: Increase lager message rate threshold from 50 to 5000
Otherwise, it drops too many messages and the log file becomes useless
when debugging.
2019-02-01 10:45:29 +01:00
Jean-Sébastien Pédron 43e40f3370 rabbitmq-run.mk: Log debug messages when using `make run-broker` 2019-02-01 10:45:29 +01:00
Jean-Sébastien Pédron dca9cad83a rabbitmq-run.mk: Configure `$RABBITMQ_FEATURE_FLAGS`
[#159298729]
2019-02-01 10:45:29 +01:00
Jean-Sébastien Pédron b4c944c880 rabbit_misc: Consider 3.7.x and 3.8.x+ compatible
... in version_minor_equivalent().

Note that we'll need a special case to exclude 3.7.x versions which
don't have the feature flags modules.

At the same time, we introduce the `strict_version_minor_equivalent()`
function which has the behavior the initial function had before. This is
used in the context of plugin compatibility checks: plugins can specify
a `broker_version_requirements` property and at this point, plugins
compatible with 3.7.x should not be considered as compatible with 3.8.x.

[#159298729]
2019-02-01 10:45:29 +01:00
Jean-Sébastien Pédron 01ef2d29dd Make #amqqueue{} a private record
See the corresponding commit in rabbitmq-server for all the
explanations.

Now, all accesses to the #amqqueue{} record are made through the
`amqqueue` module (available in rabbitmq-server). The new type name is
`amqqueue:amqqueue()`.

The `amqqueue.hrl` header also provides some macros to help with pattern
matching and guard expressions.

To help with this, code and modules were moved from rabbitmq-common to
rabbitmq-server.

[#159298729]
2019-02-01 10:45:29 +01:00
Jean-Sébastien Pédron 00ce6ffdf8 rabbit_pretty_stdout: New module to pretty-print a table
It supports ANSI colors and line drawing.
2019-02-01 10:45:25 +01:00
kjnilsson 881ebd1e02 fix dialyzer error 2019-01-31 14:58:18 +00:00
kjnilsson a9430e5d6e Add rabbit_log_ra shim
And make a new logging category for Ra logs

[#163518117]
2019-01-30 13:03:42 +00:00
Arnaud Cogoluègnes 7a624fec9b Add activity status field to consumer created
[#163298456]

References rabbitmq/rabbitmq-server#1838
2019-01-28 17:22:21 +01:00
Karl Nilsson d89ebb57c1 Merge pull request #292 from rabbitmq/rabbitmq-management-649-single-active-consumer
Integrate single active consumer with metrics
2019-01-17 10:53:16 +00:00
Michael Klishin 26cca70307 Merge pull request #294 from rabbitmq/mk-heartbeat-timeout-type-specs
Introduce a new type, heartbeat_timeout, for documentation purposes
2019-01-16 04:14:16 +03:00
Michael Klishin 1da03bf38a Use heartbeat_timeout/0 in more places 2019-01-16 04:04:10 +03:00
Michael Klishin 2704b40804 Introduce a new type, heartbeat_timeout, for documentation purposes
Per discussion with @lukebakken.
2019-01-16 04:01:21 +03:00
Luke Bakken 39bbe89259 Debug the start of heartbeat senders 2019-01-15 16:22:20 -08:00
Arnaud Cogoluègnes 74c57aced8 Integrate single active consumer with metrics
* Add single active consumer flag in consumer metrics
 * Add function to update consumer metrics when a consumer is promoted
to single active consumer

[#163089472]

References rabbitmq/rabbitmq-management#649
2019-01-15 15:15:45 +01:00
Michael Klishin 0e8d48fc70 Bump (c) year in startup banner
References rabbitmq/rabbitmq-server#1830.
2019-01-14 01:33:03 +03:00
Michael Klishin ce47d85a93 Update rabbitmq-components.mk 2019-01-10 02:08:44 +03:00
Michael Klishin 38858e62b3 Merge pull request #288 from rabbitmq/rabbitmq-server-1799-single-active-consumer-in-qq
Single active consumer in quorum queue
2019-01-09 03:03:34 +03:00
Michael Klishin bf8ac8f262 Merge branch 'master' into rabbitmq-server-1799-single-active-consumer-in-qq 2019-01-08 23:23:45 +03:00
Luke Bakken c0a2e3baec Merge branch 'rabbitmq-server-952' 2019-01-08 11:31:40 -08:00
Jean-Sébastien Pédron cbe3cc9ccc Travis CI: Use Ubuntu Xenial image
It comes with Elixir 1.7.4, therefore we don't need to install Elixir
from a Debian package.
2019-01-08 12:46:40 +01:00
Jean-Sébastien Pédron df6bb46b90 Travis CI: Test against Erlang 21.2 only
This is the minimum requirement in `master`.
2019-01-08 09:01:57 +01:00
Jean-Sébastien Pédron e1e76f25b3 Travis CI: Use Elixir 1.6.6 2019-01-08 09:01:37 +01:00
Jean-Sébastien Pédron c3628055ab Makefile: Remove the Hex.pm `maintainers` field from .app
It is now deprecated by Hex.pm.
2019-01-08 08:57:51 +01:00
Luke Bakken e33487ab63 Add sysmon_handler dependency
Fixes rabbitmq/rabbitmq-server#952
2019-01-07 12:52:06 -08:00
Michael Klishin 8fb32bd259 Be more defensive when requesting connection parameters
References #1538.
2019-01-02 14:05:36 +03:00
Michael Klishin e29005d617 Wording 2019-01-02 02:58:10 +03:00
Daniil Fedotov e7cce3b95d Reduce max message size to 512MB. 2018-12-27 19:24:57 +04:00
Arnaud Cogoluègnes 0b8841ad51 Merge branch 'master' into rabbitmq-server-1799-single-active-consumer-in-qq 2018-12-14 14:11:50 +01:00
Loïc Hoguin bf9e786749 Remove a macro related to the removed truncate module 2018-12-11 17:04:30 +01:00
Arnaud Cogoluègnes 0613d10a08 Merge branch 'master' into rabbitmq-server-1743-exclusive-consumer 2018-12-11 17:03:57 +01:00
Michael Klishin d8f5c2da24 Stop microstate accounting after sampling 2018-12-07 18:42:29 +03:00
Michael Klishin 723d1494e9 Merge branch 'master' into msacc-command 2018-12-07 15:39:51 +03:00
Jean-Sébastien Pédron 2d116f96d6 rabbitmq-hexpm.mk: Switch to hexpm-cli 0.2.0
This version should work with the latest `rebar3_hex` plugin.
2018-12-06 18:32:53 +01:00
Michael Klishin 733bcb6507 rabbitmq-components.mk: remove SockJS, rabbitmq_clusterer, rabbitmq_management_visualiser
They've been discontinued in 3.7.0.
2018-12-06 18:27:46 +03:00
Michael Klishin 1738b0aefa Merge branch 'master' into msacc-command 2018-12-05 21:52:14 +03:00
Michael Klishin 7c3d347b14 Introduce rabbit_runtime 2018-12-05 21:51:43 +03:00
Michael Klishin 05e721d1cb Support rabbit_proxy_socket tuples in rabbit_net:getstat/2
References #279.
2018-12-05 20:31:51 +03:00
Michael Klishin 93ff47fbbd Merge branch 'master' into ranch_proxy_header 2018-12-05 15:04:24 +03:00
Michael Klishin 56a4741b38 Merge pull request #283 from noxdafox/master
rabbit_backing_queue: extend is_duplicate callback return values
2018-12-05 00:04:00 +03:00
Loïc Hoguin ed7802233d Use the built-in Ranch PROXY protocol support 2018-12-04 12:29:29 +01:00
Loïc Hoguin ea18cd032b Update Ranch to 1.7.1 and Cowboy to 2.6.1 2018-11-28 15:53:03 +01:00
Matteo Cafasso 7cfb017889 rabbit_backing_queue: extend is_duplicate callback return values
Allow the backing queue implementation to inform the amqqueue process
how to proceed when a message duplicate is encountered.

 * {true, drop} the message is a duplicate and should be ignored
 * {true, reject} the message is a duplicate and the publisher should
   receive a rejection
 * false the message is not deemed a duplicate
 * true kept for backward compatibility, equivalent to {true, drop}

Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
2018-11-23 23:01:33 +02:00
Arnaud Cogoluègnes 8fa1ba43f0 Merge branch 'master' into rabbitmq-server-1743-exclusive-consumer 2018-11-22 09:35:07 +01:00
Loïc Hoguin 3a9b2134c4 Update Cowboy to 2.6 and Ranch to 1.7 2018-11-20 14:34:59 +01:00
John Eckersberg 69b4d311da rabbitmq-run.mk: Fix stop-brokers with NODES > 1
The seq command should include a -1 increment to stop nodes in reverse
order.  Previously, as an example with NODES=2, will run `seq 2 1`
which produces no items to iterate, so the entire stop-node loop does
not execute and the brokers are left running.
2018-11-16 08:52:59 -05:00
Jean-Sébastien Pédron ecc8c4e670 rabbitmq-run.mk: Add AMQP and management TCP ports to `test_rabbitmq_config`
This helps when we want to start multiple nodes on the same host with
the management plugin enabled.
2018-11-05 14:16:12 +01:00
kjnilsson 7242b2f98b add Ra as external dependency 2018-10-29 12:41:41 +00:00
Karl Nilsson c18bcb27e1 Merge pull request #274 from rabbitmq/quorum-queue
Quorum queue
2018-10-29 09:45:31 +00:00
Arnaud Cogoluègnes b204adab45 Add member/2 to priority_queue module
To check whether a value is in the queue or not. Handle both
non-priority and priority queue. Based on lists:member/2, does not take
into account the priority of the value in the queue to check equality.

References rabbitmq/rabbitmq-server#1743
2018-10-24 16:06:51 +02:00
Luke Bakken 1838b50277 Update socket stats after running handler
When a heartbeat handler is run, the socket stats should be re-collected because the act of running the handler can affect the stats (like sent bytes).

See https://groups.google.com/d/topic/rabbitmq-users/djNpSuQoznY/discussion
2018-10-22 19:39:20 -07:00
kjnilsson 0918ca4a22 remove created_at from amqqueue record 2018-10-19 16:33:38 +01:00
kjnilsson 97a17ec55a modernise pmon 2018-10-18 15:12:10 +01:00
Loïc Hoguin 4c40b6adf9 Remove dependency on erlang-src
It has been reported that in order to use the Erlang client, the
Erlang/OTP source must be available. This is due to one include
file that rabbit_net required. This dependency has been removed.

Instead of calling is_record(sslsocket) the macro ?IS_SSL will
now perform the same test manually (check that it is a tuple,
that the size is correct and that the first element equals sslsocket).

The tuple has not changed in a very long time so doing this
manually is at least as safe as including this private header
file (it could be removed or moved at any time).

Once Erlang/OTP 22 gets out and we know how sockets will be
represented with the NIF implementation, we could revise this
and check whether the socket is one that gen_tcp accepts
(currently it's a port, but this will probably change when
a NIF is used).
2018-10-17 12:30:13 +01:00
Diana Corbacho 5fd7888b8a Increase queue churn metrics when queues are deleted in bulk by node down
[#160943831]
2018-10-17 12:30:13 +01:00
Diana Corbacho d21b745d08 New connection churn metrics table
Rate metrics for monitoring of high connection churn scenarios
[#160943831]
2018-10-17 12:30:13 +01:00
Jean-Sébastien Pédron 8e0d0a0a2e include/rabbit.hrl: Bump Erlang requirement to 21.0
With the quorum queue code, RabbitMQ probably still works with Erlang
20.x, but it is not thoroughly tested. Thus, bump the requirement to
Erlang 21.0.
2018-10-11 12:36:40 +02:00
Michael Klishin 26492f4925 Merge pull request #277 from rabbitmq/rabbitmq-server-1723
Report connection/channel/queue churn
2018-10-11 02:16:55 +03:00
Loïc Hoguin adeffe8ad4 Remove dependency on erlang-src
It has been reported that in order to use the Erlang client, the
Erlang/OTP source must be available. This is due to one include
file that rabbit_net required. This dependency has been removed.

Instead of calling is_record(sslsocket) the macro ?IS_SSL will
now perform the same test manually (check that it is a tuple,
that the size is correct and that the first element equals sslsocket).

The tuple has not changed in a very long time so doing this
manually is at least as safe as including this private header
file (it could be removed or moved at any time).

Once Erlang/OTP 22 gets out and we know how sockets will be
represented with the NIF implementation, we could revise this
and check whether the socket is one that gen_tcp accepts
(currently it's a port, but this will probably change when
a NIF is used).
2018-10-09 14:48:25 +02:00
Diana Corbacho 38280262eb Increase queue churn metrics when queues are deleted in bulk by node down
[#160943831]
2018-10-09 13:16:02 +01:00
Diana Corbacho ac62721854 New connection churn metrics table
Rate metrics for monitoring of high connection churn scenarios
[#160943831]
2018-10-08 15:02:16 +01:00
Luke Bakken 02cc25124d Merge branch 'master' into quorum-queue 2018-09-28 11:45:27 -07:00
Luke Bakken 9e421db16c rabbit_pbe: re-format NotSupportedByUs list 2018-09-28 11:43:46 -07:00
Luke Bakken 3c0d95e641 rabbit_pbe: add function clauses to match sha3 hashes 2018-09-28 11:05:54 -07:00
kjnilsson 8a7441cbca Add a few applications to PLT_APPS 2018-09-28 12:59:02 +01:00
Luke Bakken d89a166a02 Improve error case if erl / erl.exe is not in PATH
Improves rabbitmq/rabbitmq-server#1654

Reported via:

https://groups.google.com/d/msg/rabbitmq-users/YgtY4R_heI0/AZFs5RPTCgAJ

VESC-906
2018-09-27 12:26:41 -07:00
Michael Klishin cbb7c38a13 Merge branch 'master' into get-empty-stats 2018-09-21 14:13:23 +02:00
Diana Corbacho f7bb8baff3 Revert "Configure ra metrics handler"
This reverts commit 1d946c91635f250677968949d79abd5b40974201.
2018-09-21 08:51:16 +01:00
Diana Corbacho baadbe8701 Configure ra metrics handler
[#157193081]
2018-09-21 08:51:16 +01:00
kjnilsson 8ce0dd6fb2 remove quorum_mapping table 2018-09-21 08:51:16 +01:00
Diana Corbacho dd82830642 Export block/unblock for flow control
[#157000583]
2018-09-21 08:51:16 +01:00
kjnilsson f76039d3da dialyzer fix 2018-09-21 08:51:16 +01:00
Diana Corbacho 5ee1757551 Revert "Add quorum_leader to amqqueue record"
This reverts commit 7eff8a551426c03725f30db8516150c1c2c127b2.
2018-09-21 08:51:16 +01:00
Diana Corbacho 4cac30b209 Add quorum_leader to amqqueue record
[#154472407]
2018-09-21 08:51:16 +01:00
Diana Corbacho 3a5e9b99a1 Add quorum_nodes to amqqueue record
[#154472231]
2018-09-21 08:51:16 +01:00
Diana Corbacho 978d7747c0 Add created_at field to amqqueue record
[#155458625]
2018-09-21 08:51:16 +01:00
Daniil Fedotov f6d18f8247 Revert Revert "Extend amqqueue record to include queue type" 2018-09-21 08:51:16 +01:00
Diana Corbacho d145becaee Use RABBITMQ_QUORUM_DIR as ra data_dir when starting a node
[#154472152]
2018-09-21 08:51:16 +01:00
Diana Corbacho a31a8329fe Create quorum_mapping table to obtain queue name from a ra id
[#154472241]
2018-09-21 08:51:16 +01:00
Diana Corbacho 3e66da916c Set the ra data_dir when starting a node
Ra is now a dependency of rabbit application, and it must be started
and configured on every rabbitmq node

[#154472152]
2018-09-21 08:51:16 +01:00
Jean-Sébastien Pédron 63661e083b rabbit_pbe: Mark AES-CCM as unsupported
This seems to be a new cipher in Erlang 22.
2018-09-19 15:40:21 +02:00
Jean-Sébastien Pédron 26cd7e4980 rabbitmq-components.mk: Bump Ranch to 1.6.2
... and ranch_proxy_protocol to 2.1.1.

Ranch 1.6.2 fixes ninenines/ranch#205 which was discovered in the
rabbitmq-stomp testsuite.

[#160270896]
2018-09-19 11:00:56 +02:00
Diana Corbacho 269434f322 Add basic.get_empty stats
The delivery stats tuple has now one more element
[#160280626]
2018-09-17 11:25:27 +01:00
Jean-Sébastien Pédron 54ddd93df5 rabbit_pbe: Mark ChaCha20 as unsupported
This seems to be a new cipher in Erlang 22.
2018-09-11 14:32:00 +02:00
Jean-Sébastien Pédron 158d07485b rabbitmq-components.mk: Bump 3rd-party dependencies' pinning
* Lager: 3.6.4 -> 3.6.5
* Ranch: 1.5.0 -> 1.6.1
* ranch_proxy_protocol: 1.5.0 -> 2.1.0-rc.1

Note that ranch_proxy_protocol 2.1.0-rc.1 is not an official release
from upstream: it was published by us (the RabbitMQ team) because we
don't have feedback from upstream about a pull request to update Ranch
to 1.6.x (heroku/ranch_proxy_protocol#49). Hopefully upstream will merge
the pull request and cut a new official release.

Fixes rabbitmq/rabbitmq-common#269.
[#160270896]
2018-09-11 14:25:16 +02:00
Daniil Fedotov 58d955fe33 Make dialyzer ignore missing gen_event:start_link/2 2018-08-21 12:52:32 +01:00
Daniil Fedotov 8f6c838a42 Remove -Wunmatched_returns from default dialyzer options. 2018-08-14 17:34:19 +01:00
Jean-Sébastien Pédron a52cd02bff rabbitmq-components.mk: Switch back to Ranch 1.5.0
... until we have a compatible ranch_proxy_protocol.
2018-08-09 17:43:24 +02:00
Jean-Sébastien Pédron b97303820c rabbitmq-components.mk: Bump 3rd-party dependencies' pinning
* Cowboy: 2.3.0 -> 2.4.0
* Cowlib: 2.2.1 -> 2.3.0
* Lager: 3.6.3 -> 3.6.4
* Ranch: 1.5.0 -> 1.6.0
* Recon: 2.3.4 -> 2.3.6

`ranch_proxy_protocol` was not updated to 2.0.0 because it drops support
for Erlang 19.3 (it requires `ssl:handlshake()`).
2018-08-09 12:06:51 +02:00
Daniil Fedotov f4210ed6d1 Make rabbit_event:notify NOT fail if rabbit_event is not started yet.
If resource alarm is triggered during the boot process it will send
an event via rabbit_event:notify. This can crash the node if rabbit_event
is not started yet. rabbit_event starts after rabbit_alarm and any alarms
on boot were crashing the node.

Calling gen_event:notify with {rabbit_event, node()} is the same as with
rabbit_event except it does not fail.
2018-07-17 17:19:50 +01:00
Michael Klishin e0491ce245 Pass authentication context to Mod:user_login_authorization/2
Part of rabbitmq/rabbitmq-server#1633.

[#158805410]
2018-07-03 23:29:43 +03:00
Jean-Sébastien Pédron 0312c6c5ed rabbirmq-run.mk: Use rabbitmqctl(1) instead of erl_call(1)
erl_call(1) is broken in Erlang 21.0-rc.2 when we use it to evaluate
some code on a remote node. The issue was reported upstream but we can
replace erl_call(1) by `rabbitmqctl eval` to achieve the same result.

The output is still filtered using sed(1) to ensure it remains
unchanged, in case testsuites expect a particular format.

We still continue to use erl_call(1) to stop a node because we can't
achieve the same behavior using rabbitmqctl(1). This use of erl_call(1)
is working with Erlang 21.0-rc.2.

[#157964874]
2018-06-07 11:38:44 +02:00
Jean-Sébastien Pédron 80db0f7e7d rabbit_pbe: Mark ChaCha20-Poly1305 as unsupported
[#157964874]
2018-06-07 11:38:43 +02:00
Michael Klishin 69814cf194 Compile Erlang/OTP 21
OTP 21 deprecated erlang:get_stacktrace/0 in favor of a new
try/catch syntax. Unfortunately that's not realistic for projects
that support multiple Erlang versions (like us) until OTP 21 can be
the minimum version requirement. In order to compile we have to ignore
the warning. The broad compiler option seems to be the most common
way to support compilation on multiple OTP versions with warnings_as_errors.

[#157964874]
2018-06-07 11:38:40 +02:00
Jean-Sébastien Pédron a993a4ab1b rabbitmq-components.mk: Update lager to 3.6.3
This version is the first one compatible with Erlang 21.x.

[#157964874]
2018-06-07 11:13:04 +02:00
Michael Klishin 03e8eac523 Handle file descriptor (I/O) stats as returned by OTP 21
Pairs: @dumbbell @dcorbacho.

[#157964874]

(cherry picked from commit 502f8c35fbc8cd882120878c543d351e7a7a6787)
2018-06-06 17:40:09 +03:00
Michael Klishin 2894a9489a Introduce MAX_SUPPORTED_PRIORITY
Part of rabbitmq/rabbitmq-server#1590.

[#157380396]
2018-05-10 21:54:03 -05:00
Michael Klishin 752254d92d rabbit_misc:pget/{2,3}: support maps
References rabbitmq/rabbitmq-federation#67, rabbitmq/rabbitmq-federation#70,
rabbitmq/rabbitmq-federation#73, rabbitmq/rabbitmq-federation#75.
2018-04-30 17:47:46 -05:00
Michael Klishin 9cac2b1337 rabbit_misc:pget/{2,3}: move spec to the defition, use modern list type signature 2018-04-30 11:34:32 -05:00
Michael Klishin 552af3f3bf Export rabbit_net:hostname/0
References rabbitmq/rabbitmq-server#1580.
2018-04-20 22:24:25 +09:00
Jean-Sébastien Pédron d9f23c1f8d rabbitmq-tools.mk: New targets to print Git repoository URLs
They are useful to query the upstream/default Git repository URLs for
both fetch and push.

[#156874375]
2018-04-18 11:43:35 +02:00
Jean-Sébastien Pédron 11cd0cd8a0 Update erlang.mk 2018-04-11 10:52:24 +02:00
Jean-Sébastien Pédron 99e9a354df rabbitmq-components.mk: Update other third-party dependencies
* Cowboy: 2.2.2 -> 2.3.0
* Cowlib: 2.1.0 -> 2.2.1
* jsx:    2.8.2 -> 2.9.0
* Lager:  3.5.1 -> 3.6.1
* recon:  2.3.2 -> 2.3.4
2018-04-11 10:44:25 +02:00
Jean-Sébastien Pédron bcb92df7a1 rabbitmq-components.mk: Update Ranch to 1.5.0
... as well as ranch_proxy_protocol to 1.5.0.
2018-04-11 10:03:49 +02:00
Jean-Sébastien Pédron 484be7d46f Travis CI: Ensure Elixir 1.6.0 is installed
We were installing the correct version but the check was not updated and
was still expecting version 1.4.5.
2018-04-09 12:02:10 +02:00
Jean-Sébastien Pédron 6db010391c Travis CI: Install Elixir 1.6.0
... instead of Elixir 1.4.5.
2018-04-09 11:54:35 +02:00
Jean-Sébastien Pédron 483aec8a4d rabbit_event: Add `gen_event:start_link/2` to `-ignore_xref()`
The code already verifies that `gen_event:start_link/2` is available
before calling it, and falls back on `gen_event:start_link/1`
appropriately.

Therefore we can add it to the `-ignore_xref()` list to fix the xref
check.
2018-04-09 09:49:58 +02:00
Michael Klishin a4d7e6c82c Export the new function 2018-04-06 08:29:24 +08:00
Michael Klishin 8a9d8e585d Merge branch 'master' into reduce-mnesia-contention-when-nodes-restart-master
Conflicts:
	src/rabbit_core_metrics.erl
	src/rabbit_event.erl
2018-04-06 08:28:55 +08:00
Michael Klishin 2d4018b550 Merge branch 'reduce-mnesia-contention-when-nodes-restart-v3.7.x' into reduce-mnesia-contention-when-nodes-restart-master
Conflicts:
	src/rabbit_core_metrics.erl
	src/rabbit_event.erl
2018-04-05 09:51:26 +08:00
Gerhard Lazu 23df30af00 Fix Erlang 19.3 support
gen_event:start_link/2 is not available before Erlang 20. RabbitMQ
3.7 needs to support Erlang 19.3 and above.

We thought of implementing different garbage collection strategies for
rabbit_event that would be compatible with Erlang 19.3, but failed
because gen_event is a special type of process:

* fullsweep_after cannot be set via process flag, it returns a badarg
  exception
* collecting on a timer would be weird because all the handlers would
  receive the event
* we can't force a full GC via hibernating, because this would need to
  run after each event, which would result in terrible performance

Partner-in-crime: @essen
2018-04-03 12:31:18 +01:00
Gerhard Lazu 85ba45a8ab Use ETS operations that are available in Erlang 19.3
ets:select_replace/2 is only available in Erlang 20 and above. RabbitMQ
3.7 needs to support Erlang 19.3 and above.

We haven't noticed any difference in performance when using one approach
over the other.

To keep the code simple, we decided to not detect which approach to use.

Partern-in-crime: @essen
2018-04-03 12:28:06 +01:00
Michael Klishin ffe132d823 Revert "Delete metrics for all deleted queues in 4 ETS operations (master)" 2018-03-28 21:31:39 +03:00
Gerhard Lazu 00951fdde9 Always run a full GC on rabbit_event
When a node has to process events generated by creating 100k
connections, 100k channels & 50k queues, it was observed that this
process would use up to 13GB of memory and never release it.

Since we are running a full GC whenever GC runs, this will slow the
process down by ~10%, but the memory usage is stable & all memory gets
eventually released. On a busy system, this can amount to many GBs.

Partner-in-crime: @essen
2018-03-28 00:56:55 +03:00
Gerhard Lazu b04bc83b55 Build smaller match spec conditions rather than a single big one
Otherwise, we can trigger a stack overflow in the Erlang VM itself, as
described in ERL-592: https://bugs.erlang.org/browse/ERL-592

The code before works fine when 50k queues are being deleted out of 100k
queues, but fails when there are 150k queues in total & 50k need to be
deleted.

Partner-in-crime: @essen
2018-03-28 00:56:55 +03:00
Gerhard Lazu c391c0468f Delete metrics for all deleted queues in 4 ETS operations
Rather than using 6 ETS operations per deleted queue, build a match
spec that matches all queues & use ets:select_replace/2 to delete
metrics all queues in 4 super efficient ETS operations.

Great suggestions @michaelklishin & @hairyhum!
ee0951b1b3 (comments)

Notice that build_match_spec_conditions_to_delete_all_queues/1 is not
tail recursive, because it's more efficient this way due to the required
return value. The exact details elude me, @essen can answer this better
than I can.

Linked to rabbitmq/rabbitmq-server#1526

For initial context, see #1513

Partner-in-crime: @essen
2018-03-28 00:56:54 +03:00
Gerhard Lazu e04076d39a Always run a full GC on rabbit_event
When a node has to process events generated by creating 100k
connections, 100k channels & 50k queues, it was observed that this
process would use up to 13GB of memory and never release it.

Since we are running a full GC whenever GC runs, this will slow the
process down by ~10%, but the memory usage is stable & all memory gets
eventually released. On a busy system, this can amount to many GBs.

Partner-in-crime: @essen
2018-03-27 16:06:36 +01:00
Gerhard Lazu 78d13ffcf9 Build smaller match spec conditions rather than a single big one
Otherwise, we can trigger a stack overflow in the Erlang VM itself, as
described in ERL-592: https://bugs.erlang.org/browse/ERL-592

The code before works fine when 50k queues are being deleted out of 100k
queues, but fails when there are 150k queues in total & 50k need to be
deleted.

Partner-in-crime: @essen
2018-03-27 16:06:36 +01:00
Gerhard Lazu d90e357a5f Delete metrics for all deleted queues in 4 ETS operations
Rather than using 6 ETS operations per deleted queue, build a match
spec that matches all queues & use ets:select_replace/2 to delete
metrics all queues in 4 super efficient ETS operations.

Great suggestions @michaelklishin & @hairyhum!
ee0951b1b3 (comments)

Notice that build_match_spec_conditions_to_delete_all_queues/1 is not
tail recursive, because it's more efficient this way due to the required
return value. The exact details elude me, @essen can answer this better
than I can.

Linked to rabbitmq/rabbitmq-server#1526

For initial context, see #1513

Partner-in-crime: @essen
2018-03-27 16:06:35 +01:00
Jean-Sébastien Pédron f6534839a0 Travis CI: Test against Erlang 20.3 instead of 20.1 2018-03-26 17:34:09 +02:00
Jean-Sébastien Pédron 9dc474006b Travis CI: Don't send notifications for successful builds 2018-03-26 15:28:22 +02:00
Arnaud Cogoluègnes ab085c7dec Merge pull request #255 from rabbitmq/rabbitmq-server-1538-master
Merge rabbitmq-server-1538 to master
2018-03-14 15:36:24 +01:00
Arnaud Cogoluègnes f71878a3da Merge pull request #253 from rabbitmq/rabbitmq-server-1538
Check process before getting amqp_params
2018-03-14 15:35:15 +01:00
Jean-Sébastien Pédron b4b8c8057e rabbitmq-early-test.mk: Start common_test node with `-hidden`
That way, it doesn't interfere with testcases working with multiple
RabbitMQ nodes. Furthermore, independent sets of nodes won't try to
autoconnect to the common_test node, and thus unrelated nodes after.
This is useful for the upcoming VM-based test helpers.

[#153749132]

(cherry picked from commit 47a5bdfff548a5c278af2d947feeeb7836aae0c3)
2018-03-06 22:26:12 +03:00
Jean-Sébastien Pédron 343395d605 rabbit_misc:is_process_alive(): Consider hidden nodes
... while checking if we are connected to the given PID's node. This
fixes an issue where an Erlang client, connected directly to the
RabbitMQ node (as opposed to a TCP connection), is running an a hidden
Erlang node.

[#153749132]

(cherry picked from commit 48df58b63dc1157a9954fc5413aa027cb9552db8)
2018-03-06 22:26:03 +03:00
Jean-Sébastien Pédron ce23bfb8a9 rabbitmq-early-test.mk: Start common_test node with `-hidden`
That way, it doesn't interfere with testcases working with multiple
RabbitMQ nodes. Furthermore, independent sets of nodes won't try to
autoconnect to the common_test node, and thus unrelated nodes after.
This is useful for the upcoming VM-based test helpers.

[#153749132]

(cherry picked from commit 5c0546fb5bf9e7d61e90399373b11962011f548d)
2018-03-06 21:49:17 +03:00
Jean-Sébastien Pédron e848d51422 rabbit_misc:is_process_alive(): Consider hidden nodes
... while checking if we are connected to the given PID's node. This
fixes an issue where an Erlang client, connected directly to the
RabbitMQ node (as opposed to a TCP connection), is running an a hidden
Erlang node.

[#153749132]

(cherry picked from commit 66f5ae28ea993d761507dbd9034d59491f0d2bc6)
2018-03-06 21:49:06 +03:00
Luke Bakken d7d4fd7b8b Merge branch 'rabbitmq-server-1538' into rabbitmq-server-1538-master 2018-03-06 10:23:18 -08:00
Luke Bakken 04d4cd601e Check process before getting amqp_params
Fixes rabbitmq/rabbitmq-server#1538

Handle the bad_argument case from rabbit_reader
2018-03-06 10:12:56 -08:00
Jean-Sébastien Pédron e232a6080e Revert "rabbitmq-early-test.mk: Start common_test node with `-hidden`"
This reverts commit 878628a1f9.
2018-03-05 14:50:20 +01:00
Jean-Sébastien Pédron 18985a1007 Merge branch 'hide-common_test-node' 2018-03-05 12:25:22 +01:00
Jean-Sébastien Pédron 878628a1f9 rabbitmq-early-test.mk: Start common_test node with `-hidden`
That way, it doesn't interfere with testcases working with multiple
RabbitMQ nodes. Furthermore, independent sets of nodes won't try to
autoconnect to the common_test node, and thus unrelated nodes after.
This is useful for the upcoming VM-based test helpers.

[#153749132]
2018-03-05 12:23:21 +01:00
Jean-Sébastien Pédron faea76a8bd Update erlang.mk 2018-03-02 19:03:13 +01:00
Jean-Sébastien Pédron 02c35a07f9 Update erlang.mk 2018-03-02 18:35:21 +01:00
Jean-Sébastien Pédron c969f3756f Update erlang.mk 2018-03-02 18:29:48 +01:00
Michael Klishin b68cd5e2b3 Handle {ongoing_change_to, NewValue} responses from net_kernel:set_net_ticktime/2
See rabbitmq/rabbitmq-server#1524 and rabbitmq/rabbitmq-server#1522 for details.

(cherry picked from commit 75e2f71562)
2018-02-23 00:34:16 +03:00
Michael Klishin 75e2f71562 Handle {ongoing_change_to, NewValue} responses from net_kernel:set_net_ticktime/2
See rabbitmq/rabbitmq-server#1524 and rabbitmq/rabbitmq-server#1522 for details.
2018-02-22 20:14:35 +03:00
Jean-Sébastien Pédron b0ef541275 Merge branch 'fix-dialyzer-errors-part2' 2018-02-02 10:24:05 +01:00
Jean-Sébastien Pédron 7be4181672 rabbit_net: Ignore Dialyzer warnings in socket_ends() and unwrap_socket()
Those functions are currently looking into opaque types from
`ranch_proxy_protocol`. Until this is fixed, we just ignore the warnings
and comment out the specs.

[#153850881]
2018-02-01 17:18:45 +01:00
Jean-Sébastien Pédron a323a8a94c Explicitly ignore return values we don't care about
These warnings were reported by Dialyzer.

[#153850881]
2018-02-01 17:13:02 +01:00
Jean-Sébastien Pédron 6670fd94f3 lager_forwarder_backend: Fix spec of #state{}
It was missing the 'inherit' value of the `level` member.

The warning was reported by Dialyzer.

[#153850881]
2018-02-01 17:11:55 +01:00
Jean-Sébastien Pédron 3be47d477e rabbitmq-build.mk: Only add rabbitmq-cli to compiler path for plugins
rabbitmq-common shouldn't see this, otherwise it's a reverse dependency
and thus a dependency circle.

In the future, we should fix this by adding rabbitmq-cli as an explicit
dependency to whatever component needs it.

[#153850881]
2018-02-01 17:09:26 +01:00
Jean-Sébastien Pédron fa3c5c9ea0 Merge branch 'fix-dialyzer-errors' into v3.7.x 2018-02-01 16:21:48 +01:00
Jean-Sébastien Pédron b8cce2ad54 Merge branch 'fix-dialyzer-errors' into fix-dialyzer-errors-in-master 2018-02-01 13:19:35 +01:00
Jean-Sébastien Pédron 570354013a vm_memory_monitor: Fix spec of get_cached_process_memory_and_limit()
The second element of the tuple either a float or 'infinity', never an
integer.

The warning was reported by Dialyzer.

[#153850881]
2018-02-01 13:17:00 +01:00
Jean-Sébastien Pédron f6377842a9 gen_server2: Document that terminate() doesn't return
While here, silence the same warning for do_multi_call() because it
comes from an anonymous function. We could move the anonymous function
to a regular function and give it a spec. However, we prefer to keep the
diff with upstream small.

[#153850881]
2018-02-01 13:17:00 +01:00
Jean-Sébastien Pédron c2ee056d06 rabbit_core_metrics: Fix return values of several functions
They were returning `true` (the return value of ets:insert() or
ets:delete()), whereas many others were returning `ok`. So make them
return `ok` for consistency's sake. Furthermore it matches their
specification.

These warnings were reported by Dialyzer.

[#153850881]
2018-02-01 13:16:59 +01:00
Jean-Sébastien Pédron f462be8d9f rabbit_log: Document that handle_damaged_io_system() doesn't return
The warning was reported by Dialyzer.

[#153850881]
2018-02-01 13:16:59 +01:00
Jean-Sébastien Pédron 36598fc8b2 rabbit_misc: Fix specs of rpc_call() and get_gc_info()
These warnings were reported by Dialyzer().

[#153850881]
2018-02-01 13:16:59 +01:00
Jean-Sébastien Pédron 1032d8551c rabbit_heartbeat, rabbit_writer: system_terminate() doesn't return
Thus, use the correct return type of `no_return()`. Even if it's defined
as `none()` according to the documentation, it doesn't have the same
semantic.

The warning was reported by Dialyzer.

[#153850881]
2018-02-01 13:16:59 +01:00
Jean-Sébastien Pédron 55a794d357 supervisor2: #state.dynamics can be 'undefined'
The warning was reported by Dialyzer.

[#153850881]
2018-02-01 13:16:59 +01:00
Jean-Sébastien Pédron 531c551575 Merge branch 'add-dialyzer-attr-support-to-code_version' 2018-01-31 17:37:39 +01:00
Jean-Sébastien Pédron 9b10d49a25 Explicitly ignore return values we don't care about
These warnings were reported by Dialyzer.

[#153850881]
2018-01-31 17:27:01 +01:00
Jean-Sébastien Pédron 236a4f4bb5 worker_pool_worker: Fix set_timeout() specifications
This warning was reported by Dialyzer.

[#153850881]
2018-01-31 17:27:01 +01:00
Jean-Sébastien Pédron 68fe28b076 app_utils: Document explicitly anonymous functions which throw exceptions
Anonymous functions were converted to regular functions so that we could
add `-spec()` directives.

The `spec()` for the `error_handler()` callback was updated to accept
functions throwing exceptions.

This was reported by Dialyzer.

[#153850881]
2018-01-31 17:27:01 +01:00
Jean-Sébastien Pédron 591e3e23e3 .gitignore: Ignore PLT files from Dialyzer
[#153850881]
2018-01-31 17:27:01 +01:00
Jean-Sébastien Pédron caff514fe9 Merge branch 'add-dialyzer-attr-support-to-code_version' into v3.7.x 2018-01-31 17:25:49 +01:00
Jean-Sébastien Pédron 6419b8b8cc ssl_compat: Restore Dialyzer attribute now that `code_version` works with it
This reverts commit bc59e69e31.

[#154054286]
2018-01-31 17:08:11 +01:00
Jean-Sébastien Pédron 8df464d1cf code_version: Handle `-dialyzer` attributes
They can mention functions which we are removing or renaming. Therefore
we need to apply the same changes to the `-dialyzer` attribute(s).

[#154054286]
2018-01-31 17:07:58 +01:00
Jean-Sébastien Pédron ec7bdb3ab5 Merge branch 'limit-rabbitmq-components.mk-update-to-same-branch' into v3.7.x 2018-01-30 16:20:56 +01:00
Jean-Sébastien Pédron 7e342b04d6 Merge branch 'limit-rabbitmq-components.mk-update-to-same-branch' 2018-01-30 15:04:48 +01:00
Jean-Sébastien Pédron cca83231f0 rabbitmq-tools.mk: Move `rabbitmq-components.mk`-related targets there
This way, we are sure that the possibly newer recipe in
`rabbitmq-tools.mk` handles the operation instead of a possibly obsolete
`rabbitmq-components.mk` copy.

[#154761483]
2018-01-30 14:54:37 +01:00
Jean-Sébastien Pédron 73e2e89312 rabbitmq-components.mk: Compare branch names before updating `rabbitmq-components.mk`
To avoid a copy of `rabbitmq-components.mk` from rabbitmq-common's
`v3.6.x` branch to another component's `master` branch, we want to
compare branch names of both repositories.

This situation may occur when checking out the `v3.6.x` in the Umbrella
using `gmake up BRANCH=v3.6.x` but for instance some plugins don't have
such a branch. In this case, they remain on the previous branch. We
don't want to overwrite their `rabbitmq-components.mk` if this happens.

[#154761483]
2018-01-30 14:51:27 +01:00
Luke Bakken 21b10e9a9a Merge branch 'cowboy-update-154176350' 2018-01-29 16:20:02 -08:00