Commit Graph

1268 Commits

Author SHA1 Message Date
Arnaud Cogoluègnes 6b9589bae4
Handle stream arguments in add_super_stream command
max-age, leader-locator, etc.
2021-10-11 16:50:03 +02:00
Michael Klishin 798be7dcaf
Peer discovery AWS, K8S: more Dialyzer fixes 2021-10-07 03:42:44 +03:00
Loïc Hoguin 0a2bde4ab1
Use the new function ranch_proxy_header:to_connection_info/1 2021-09-09 13:15:08 +02:00
Paweł Chmielowski 6af41527f1 Fix some edge cases in handling ssl information from PROXY protocol
When we fail to parse name of cipher suite from PROXY protocol
just say that no ssl is used, instead of trying to fill that
with data from connection between proxy and our server.
2021-09-06 19:36:42 +02:00
Jean-Sébastien Pédron 689c56cb04
Logging: Add `single_line` flag support to $RABBITMQ_LOG
A user could already enable single-line logging (the `single_line`
option of `logger_formatter` or RabbitMQ internal formatters) from the
configuration file. For example:

    log.console.formatter.single_line = on

With this patch, the option can be enabled from the `$RABBITMQ_LOG`
environment variable as well:

    make run-broker RABBITMQ_LOG=+single_line
2021-09-01 09:31:54 +02:00
Jean-Sébastien Pédron 33c6cbf239
rabbit_env: Add $RABBITMQ_DEFAULT_{USER,PASS,VHOST} and $RABBITMQ_ERLANG_COOKIE vars
Those environment variables are unset by default. The default values are
set in the `rabbit` application environment and can be configured in the
configuration file. However, the environment variables will take
precedence over them respectively if they are set.
2021-08-11 15:50:36 +02:00
Michael Klishin c84115f102
Warn when lock could not be acquired successfully 2021-08-05 11:31:35 +03:00
Michael Klishin 22add3c8ca
Acquire locks when starting mirrored supervisor children
Unlike pg2, pg in Erlang 24 is eventually consistent. So this
reintroduces some of the same kind of locking mirrored_supervisor
used to rely on implicitly via pg2.

Per discussion with @lhoguin.

Closes #3260.

References #3132, #3154.
2021-08-05 00:39:16 +03:00
Michael Klishin 9a0f4b17cd
More mirrored supervisor logging 2021-08-04 16:58:44 +03:00
Michael Klishin 4f3d5e5e13
Mirrored supervisor: more logging at debug level 2021-08-04 15:56:45 +03:00
Ilya Khaprov 854f26ac18
Do not crash on badarg when env file has an 'unusual' unicode character
closes #3212
2021-07-28 16:39:17 +02:00
Jean-Sébastien Pédron 80b428d5d3
rabbit_runtime: Find erl(1) in the ERTS bin directory
erl(1) might not be in the directory pointed by init's root argument.
This is the case with Erlang releases built with relx for instance.
2021-07-22 10:21:37 +02:00
Paweł Chmielowski d5daf7598b Extract TLS informations that are delivered in PROXY protocol frame 2021-07-05 13:29:59 +02:00
Michael Klishin 65ccf7ce42
Mirrored supervisor: make it easier to keep track of group membership changes
in the logs.

Referenes #3148.
2021-07-05 14:02:37 +03:00
Michael Klishin 4f01d450e0
Make sure not to wait for epmd-starter subprocess forever
Per discussion in #3162
2021-06-30 15:20:09 +03:00
Michael Klishin 62e7785a48
Canonicalize a few more paths in the startup banner
References #3149
2021-06-28 13:48:13 +03:00
Philip Kuryloski 9053d96ca0 Fix call to deprecated function
https://erlang.org/doc/general_info/deprecations.html#otp-22
2021-05-19 13:38:17 +02:00
Michael Klishin fc7501c309
Convert policy event keys to atoms
so that they are easier to match on
2021-04-28 12:57:06 +03:00
Michael Klishin 60a9a89940
Allow for more ASN.1 string (sub)types 2021-04-20 01:19:38 +03:00
Michael Klishin 73eb9b56ec
Decode other name using 'OTP-PUB-KEY':decode/2
and assume it is a string-like value ("directory string")
because other values would not make much sense in the
username extraction context.

References #2983.
2021-04-20 01:16:29 +03:00
Michael Klishin e15f2b46f3
SAN of type otherName: strip two leading characters
instead of specific ones since they will vary with the payload
(one of them likely indicates UTF string length).

This is still not perfect because we limit the maximum
allowed length but it works fine with identifiers up to 100
characters long, which should be good enough for this
best effort handling of an abscure SAN type.

References ##2983.
2021-04-20 00:20:44 +03:00
Michael Klishin 1587501733
Pass Dialyzer
x.509 certificate extensions do not really have types in
OTP's public_key, so our hands are tied.
2021-04-19 13:56:39 +03:00
Michael Klishin 81f3005b95
rabbit_common: pass Dialyzer 2021-04-19 13:41:29 +03:00
Jean-Sébastien Pédron 6936f2d8a9 rabbit_env: Fix Bourne shell concatenated literal parsing
The parser didn't handle literals of the form:
    'single-quoted'unquoted'single-quoted-again'"or-even-double-quoted"

In particular, the unquoted parsing assumed that nothing else could
follow it. The testsuite is extended with the issue reporter's case.

While here, improve escaped characters handling. They used to be not
parsed specifically at all.

Fixes #2969.
2021-04-19 12:32:53 +02:00
Michael Klishin 21a6b1ba05
x.509 certificate auth mechanism: support (some) SANS of type otherName
Note that the type by definition contains arbitrary values. According
to the OTP types, they are triplets that represent effectively
a key/value pair. So we assume the pair is a string that needs a bit
massaging, namely stripping the UTF encoding prefix OTP AnotherName
decoder leaves in.

Kudos to @Thibi2000 for providing an example value.

Closes #2983.
2021-04-19 02:33:26 +03:00
Jean-Sébastien Pédron 3d1db4b676 rabbit_env: Fix arguments to the ?LOG_DEBUG format string
Format string arguments must be in a list.
2021-04-13 14:20:19 +02:00
Michael Klishin 7f98bc3d1c
Add more VM memory monitor tests, pass Dialyzer
(cherry picked from commit 57ec1f8768)
2021-04-11 11:36:30 +03:00
Michael Klishin 19b104a22f
Update vm_memory_high_watermark/0 type 2021-04-11 10:43:38 +03:00
Michael Klishin 30cbbba167
High VM watermark: support {relative, N} values set via advanced.config
for usability. It is not any different from when a float value
is used and only exists as a counterpart to '{absolute, N}'.

Also nothing changes for rabbitmq.conf users as that format performs
validation and correct value translation.

See #2694, #2965 for background.
2021-04-11 10:28:35 +03:00
Carl Hörberg aac99700e7 get destination address from PROXY protocol 2021-03-30 12:58:49 +02:00
Philip Kuryloski 388654c542
Add a partial Bazel build (#2938)
Adds WORKSPACE.bazel, BUILD.bazel & *.bzl files for partial build & test with Bazel. Introduces a build-time dependency on https://github.com/rabbitmq/bazel-erlang
2021-03-29 11:01:43 +02:00
David Ansari dc589856f2 Wait between retries if nxdomain
In kind version 0.10.0, when creating a 5-node RabbitMQ cluster
with the new parallel PodManagementPolicy, we observed that some
pods were restarted. Their logs included:

```
10:10:03.794 [error]
10:10:03.804 [error] BOOT FAILED
10:10:03.805 [error] ===========
BOOT FAILED
10:10:03.805 [error] ERROR: epmd error for host r1-server-0.r1-nodes.rabbitmq-system: nxdomain (non-existing domain)
10:10:03.805 [error]
===========
ERROR: epmd error for host r1-server-0.r1-nodes.rabbitmq-system: nxdomain (non-existing domain)
10:10:04.806 [error] Supervisor rabbit_prelaunch_sup had child prelaunch started with rabbit_prelaunch:run_prelaunch_first_phase() at undefined exit with reason {epmd_error,"r1-server-0.r1-nodes.rabbitmq-system",nxdomain} in context start_error
10:10:04.806 [error] CRASH REPORT Process <0.152.0> with 0 neighbours exited with reason: {{shutdown,{failed_to_start_child,prelaunch,{epmd_error,"r1-server-0.r1-nodes.rabbitmq-system",nxdomain}}},{rabbit_prelaunch_app,start,[normal,[]]}} in application_master:init/4 line 138
```

Eventually, after some pods restarted up to 2 times, all pods were running and ready.

In kind, we observed that during the first couple of seconds, nslookup was failing as well for that domain
with nxdomain.
It took up to 30 seconds until nslookup succeeded.

With this commit, pods don't need to be restarted when creating a fresh
RabbitMQ cluster.
2021-03-18 18:21:02 +01:00
Michael Klishin 97ff62d3b2
Drop trailing newlines from logged messages where possible
Lager strips trailing newline characters but OTP logger with the default
formatter adds a newline at the end. To avoid unintentional multi-line log
messages we have to revisit most messages logged.

Some log entries are intentionally multiline, others
are printed to stdout directly: newlines are required there
for sensible formatting.
2021-03-11 15:17:37 +01:00
Jean-Sébastien Pédron cdcf602749
Switch from Lager to the new Erlang Logger API for logging
The configuration remains the same for the end-user. The only exception
is the log root directory: it is now set through the `log_root`
application env. variable in `rabbit`. People using the Cuttlefish-based
configuration file are not affected by this exception.

The main change is how the logging facility is configured. It now
happens in `rabbit_prelaunch_logging`. The `rabbit_lager` module is
removed.

The supported outputs remain the same: the console, text files, the
`amq.rabbitmq.log` exchange and syslog.

The message text format slightly changed: the timestamp is more precise
(now to the microsecond) and the level can be abbreviated to always be
4-character long to align all messages and improve readability. Here is
an example:

    2021-03-03 10:22:30.377392+01:00 [dbug] <0.229.0> == Prelaunch DONE ==
    2021-03-03 10:22:30.377860+01:00 [info] <0.229.0>
    2021-03-03 10:22:30.377860+01:00 [info] <0.229.0>  Starting RabbitMQ 3.8.10+115.g071f3fb on Erlang 23.2.5
    2021-03-03 10:22:30.377860+01:00 [info] <0.229.0>  Licensed under the MPL 2.0. Website: https://rabbitmq.com

The example above also shows that multiline messages are supported and
each line is prepended with the same prefix (the timestamp, the level
and the Erlang process PID).

JSON is also supported as a message format and now for any outputs.
Indeed, it is possible to use it with e.g. syslog or the exchange. Here
is an example of a JSON-formatted message sent to syslog:

    Mar  3 11:23:06 localhost rabbitmq-server[27908] <0.229.0> - {"time":"2021-03-03T11:23:06.998466+01:00","level":"notice","msg":"Logging: configured log handlers are now ACTIVE","meta":{"domain":"rabbitmq.prelaunch","file":"src/rabbit_prelaunch_logging.erl","gl":"<0.228.0>","line":311,"mfa":["rabbit_prelaunch_logging","configure_logger",1],"pid":"<0.229.0>"}}

For quick testing, the values accepted by the `$RABBITMQ_LOGS`
environment variables were extended:
  * `-` still means stdout
  * `-stderr` means stderr
  * `syslog:` means syslog on localhost
  * `exchange:` means logging to `amq.rabbitmq.log`

`$RABBITMQ_LOG` was also extended. It now accepts a `+json` modifier (in
addition to the existing `+color` one). With that modifier, messages are
formatted as JSON intead of plain text.

The `rabbitmqctl rotate_logs` command is deprecated. The reason is
Logger does not expose a function to force log rotation. However, it
will detect when a file was rotated by an external tool.

From a developer point of view, the old `rabbit_log*` API remains
supported, though it is now deprecated. It is implemented as regular
modules: there is no `parse_transform` involved anymore.

In the code, it is recommended to use the new Logger macros. For
instance, `?LOG_INFO(Format, Args)`. If possible, messages should be
augmented with some metadata. For instance (note the map after the
message):

    ?LOG_NOTICE("Logging: switching to configured handler(s); following "
                "messages may not be visible in this log output",
                #{domain => ?RMQLOG_DOMAIN_PRELAUNCH}),

Domains in Erlang Logger parlance are the way to categorize messages.
Some predefined domains, matching previous categories, are currently
defined in `rabbit_common/include/logging.hrl` or headers in the
relevant plugins for plugin-specific categories.

At this point, very few messages have been converted from the old
`rabbit_log*` API to the new macros. It can be done gradually when
working on a particular module or logging.

The Erlang builtin console/file handler, `logger_std_h`, has been forked
because it lacks date-based file rotation. The configuration of
date-based rotation is identical to Lager. Once the dust has settled for
this feature, the goal is to submit it upstream for inclusion in Erlang.
The forked module is calld `rabbit_logger_std_h` and is based
`logger_std_h` in Erlang 23.0.
2021-03-11 15:17:36 +01:00
Michael Klishin fd86959429
Revert "Make rabbit_log:log/2 return 'ok' unconditionally"
This reverts commit 01c4ca2aa9.
2021-03-04 13:13:00 +03:00
Michael Klishin 01c4ca2aa9
Make rabbit_log:log/2 return 'ok' unconditionally
instead of relying on a Lager transform-driven return value.

This should avoid erlang/otp#4576 on Erlang 24.

Per discussion with @lhoguin.
2021-03-04 13:09:29 +03:00
Michael Klishin 8920f05a15
Revert "Squash one more Erlang 24 warning"
This reverts commit fb4f88e7dd.

See erlang/otp#4576
2021-03-04 06:10:23 +03:00
Michael Klishin fb4f88e7dd
Squash one more Erlang 24 warning 2021-03-04 05:38:38 +03:00
Michael Klishin fab351134a
Drive-by: squash an Erlang 24-specific warning
(cherry picked from commit 3a169cc9df)
2021-03-04 05:31:26 +03:00
Michael Klishin 98724eff09
pg2 => pg for OTP 24 compatibility
there is still one failing queue federation test.
2021-03-03 19:01:12 +03:00
Jean-Sébastien Pédron 561d2e660d
rabbit_env: Use consistent style 2021-02-25 11:13:23 +01:00
Michael Klishin 98b46b2ffb
rabbit_env: pass Dialyzer again 2021-02-25 06:22:36 +03:00
Michael Klishin 7e93cc8d3b
rabbit_env: remove one more direct call to os:list_env_vars/0 2021-02-25 06:13:41 +03:00
Michael Klishin 26b676f021
Try ignore_xref 2021-02-25 06:11:18 +03:00
Michael Klishin cdd0c1662c
Pass xref on OTP 22 and 23 2021-02-25 06:08:16 +03:00
Michael Klishin 752f16abf7
os:list_env_vars/0 was renamed to os:env/0 in OTP 24 2021-02-25 01:10:40 +03:00
Michael Klishin 00b7a84191
Limit direct reply-to identifier length growth
as node names grow.

Prior to this change, direct reply-to consumer channels
were encoded using term_to_binary/1, which means the result
would grow together with node name (since node name
is one of the components of an Erlang pid type).

This means that with long enough hostnames, reply-to
identifiers could overflow the 255 character limit of
message property field type, longstr.

With this change, the encoded value uses a hash of the node name
and then locates the actual node name from a map of
hashes to current cluster members.

In addition, instead of generating non-predictable "secure"
GUIDs the feature now generates "regular" predictable GUIDs
which compensates some of the additional PID pre- and post-processing
outlined above.
2021-02-24 18:21:26 +03:00
Michael Klishin 52479099ec
Bump (c) year 2021-01-22 09:00:14 +03:00
Michael Klishin f9e2996b51
Refactor #2733 a bit more 2021-01-21 15:09:20 +03:00
Michael Klishin 9176944c95
Use slightly more idiomatic Erlang 2021-01-21 11:56:30 +03:00
tomyouyou ae173f11bb
'get_memory_use(ratio)' will have an exception when MemoryLimit is 'infinity' 2021-01-21 16:14:56 +08:00
Michael Klishin a087621257
Handle a 'noport' clause here
Follow-up to #2722
2021-01-16 18:56:13 +05:00
Michael Klishin 075ee09996
Naming, wording 2021-01-16 01:45:12 +05:00
Gabriele Santomaggio 19d28f260a Add log 2021-01-15 13:04:24 +01:00
Gabriele Santomaggio 9ec5b4bf86 Add spec 2021-01-15 11:17:43 +01:00
Gabriele Santomaggio ce5550b974 Add retry for epdm name (hostname)
fixes https://github.com/rabbitmq/rabbitmq-server/issues/2718
2021-01-15 09:09:19 +01:00
Arnaud Cogoluègnes 41160210ab
Start stream consumer REST endpoint 2020-12-01 18:23:22 +01:00
Luke Bakken fd73767051 Revert "Handle potential undefined value returned from process dictionary"
This reverts commit 04627ef2ef.
2020-11-02 10:02:46 -08:00
Michael Klishin e6972966bb Part of rabbitmq/rabbitmq-auth-mechanism-ssl#12 2020-10-30 18:46:09 +03:00
Michael Klishin 4dfffd312f Remove a (now) unused delegate 2020-10-20 21:14:42 +03:00
Luke Bakken f0c1d17e3a Remove code to guess thread pool size
Part of rabbitmq/rabbitmq-server#2473
2020-10-20 10:23:54 -07:00
Luke Bakken 04627ef2ef Handle potential undefined value returned from process dictionary
CI failures such as this suggest that file handle values can be deleted
mid-operation:

https://github.com/rabbitmq/rabbitmq-server/actions/runs/304216635
2020-10-15 05:49:16 -07:00
Michael Klishin 45158f49ac Merge pull request #409 from rabbitmq/auth-attempt-metrics
Add auth attempt metrics
2020-10-14 23:56:02 +03:00
Jean-Sébastien Pédron b9defc1bff rabbit_env: Fix parsing of $CONF_ENV_FILE output
The `set` command in the implementation of `/bin/sh` included in the
official RabbitMQ Docker image returns multi-line variable values
differently than the tested Bourne shell implementation (GNU Bash, dash
and FreeBSD sh).

I don't know what implementation is used by that Docker image, but here
is the output of `set`, for a variable set to "\n'test'":

    TEST_VAR='
    '"'"'test'"'"

The problem was reported in the following discussion:
https://github.com/rabbitmq/rabbitmq-server/discussions/2458

While here, add a small testcase to check a couple outputs.
2020-10-07 15:33:49 +02:00
kjnilsson db59327963 Move rabbit_mics:confirm_to_sender/3 to server
As it is only used by the server and does not need to be a shared
function.
2020-10-07 13:05:07 +01:00
Nicolas Caille 6f3681210e remove TLSv1.3 from BAD_SSL_PROTOCOL_VERSIONS 2020-10-06 21:27:53 +02:00
Jean-Sébastien Pédron e5127eaea3 rabbit_log: Restore alphabetical order in the defintion of category() 2020-10-05 14:21:52 +02:00
kjnilsson e0a210cc67 Dialyzer fixes 2020-10-02 10:22:10 +01:00
kjnilsson 28b6b812b1 Add osiris logger sink 2020-09-30 14:41:59 +01:00
kjnilsson bbd0cc8198 Add osiris logging shim 2020-09-30 14:41:59 +01:00
kjnilsson f7dcd081fa change return message format 2020-09-30 14:41:59 +01:00
dcorbacho 0cec212896 Stream queue data dir 2020-09-30 14:41:59 +01: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
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
Luke Bakken 4c9d67bb9d Do not change the behavior of rpc_call 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
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
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
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
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
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
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
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 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 c3db0a1beb Introduce rabbit_types:error/2
Part of #2356.
2020-05-30 04:41:29 +03: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
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 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
Michael Klishin a8017e8675 rabbit_event:notify/{2,3}: support map events 2020-04-25 21:48:47 +03: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
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
Jean-Sébastien Pédron fa4b552a9b Update copyright (year 2020) 2020-03-10 15:26:49 +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 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 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 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 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 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 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
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 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
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
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
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 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
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
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 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
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
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
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
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
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
Loïc Hoguin 944f0087bf Make rabbit_pbe work for OTP-22 2019-03-19 15:02:24 +01: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
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
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 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 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 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 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 bf8ac8f262 Merge branch 'master' into rabbitmq-server-1799-single-active-consumer-in-qq 2019-01-08 23:23:45 +03:00
Michael Klishin 8fb32bd259 Be more defensive when requesting connection parameters
References #1538.
2019-01-02 14:05:36 +03: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 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
Loïc Hoguin ed7802233d Use the built-in Ranch PROXY protocol support 2018-12-04 12:29:29 +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
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 97a17ec55a modernise pmon 2018-10-18 15:12:10 +01:00