Commit Graph

98 Commits

Author SHA1 Message Date
Iliia Khaprov bcdb0b7067
Queues with plugins - remove unused include form rabbit registry suite 2025-05-17 23:33:12 +02:00
Diana Parra Corbacho cfd51bac6c
Queues with plugins - fix rabbit_registry_SUITE 2025-05-17 20:48:00 +02:00
Iliia Khaprov 59701a0ea9
Queues with plugins - Diana's review 2025-05-17 20:47:55 +02:00
Jean-Sébastien Pédron e58eb1807a
Move `file_handle_cache` and `vm_memory_monitor` back to `rabbit`
[Why]
They were moved from `rabbit` to `rabbit_common` several years ago to
solve an dependency issue because `amqp_client` depended on the file
handle cache. This is not the case anymore.

[How]
The modules are moved back to `rabbit`.

`rabbit_common` doesn't need to depend on `os_mon` anymore. `rabbit`
already depends on it, so no changes needed here.

`include/rabbit_memory.hrl` and some test cases are moved as well to
follow the `vm_memory_monitor` module.
2025-05-07 09:46:14 +02:00
Michael Klishin 968eefa1bb
Bump (c) line year
There are no functional changes to this massive diff.
2025-01-01 17:54:10 -05:00
Michael Klishin 9b1953994e
One more test case for #12888 2024-12-03 23:07:58 -05:00
Ace Breakpoint ee41983e84 Fix crash caused by mishandling of non-ascii amqp_error explaination
`rabbit_binary_generator:map_exception/3` will crash when there are
unicode characters in the `explaination` field of `Reason#amqp_error`
parameter. The explaination string (list) is assumed to be ascii, with
each character/member in the range of a byte. Any unicode characters
in the string will trigger `badarg` crash of `list_to_binary/1` in
`rabbit_binary_generator:amqp_exception_explanation/2`.

Amqp091 shovel crash due to this is reported,
https://github.com/rabbitmq/rabbitmq-server/discussions/12874
When a queue as shovel source/destination does not exist, and its
name contains non-ascii characters, the explaination of amqp_error
will be like `no queue non_ascii_name_😍 in vhost /`. It will
subsequently crash and even affect management console.

To fix this, `unicode:characters_to_binary/1` is used instead of
`list_to_binary/1`, and unicode-safe truncation of long explaination
with `io_lib:format/3` chars_limit replaces direct bytes truncation.
2024-12-04 10:39:16 +08:00
Jean-Sébastien Pédron 9b2c6d95f8
rabbit_env: Drop $RABBITMQ_LOG_FF_REGISTRY
[Why]
Its use was removed when the registry was converted from a compiled
module to a persistent_term.
2024-10-07 14:02:50 +02:00
Michal Kuratczyk cfa3de4b2b
Remove unused imports (thanks elp!) 2024-05-23 16:36:08 +02:00
Jean-Sébastien Pédron c298a02574
rabbit_env_SUITE: Wait for application env. to be ready
[Why]
If the testcase run between the time the node is started and the time
the `rabbit` application environment is loaded, it will fail.

[How]
Instead of waiting for the node to be reachable only, we also wait for
the `rabbit` application environment to be filled.
2024-03-18 16:39:35 +01:00
Jean-Sébastien Pédron c6992d0250
rabbit_env_SUITE: Use a large timeout in `check_values_from_reachable_remote_node()`
[Why]
It looks to fail frequently in CI.
2024-03-12 13:16:46 +01:00
Michael Klishin f414c2d512
More missed license header updates #9969 2024-02-05 11:53:50 -05:00
Michael Klishin 7b151a7651 More missed (c) header updates 2024-01-22 23:44:47 -05:00
Michael Klishin fb775afcc8
More (c) source header updates #9969 2024-01-19 19:53:28 -05:00
Michael Klishin 01092ff31f
(c) year bumps 2024-01-01 22:02:20 -05:00
Michael Klishin 1b642353ca
Update (c) according to [1]
1. https://investors.broadcom.com/news-releases/news-release-details/broadcom-and-vmware-intend-close-transaction-november-22-2023
2023-11-21 23:18:22 -05:00
Luke Bakken aefca26431
Fix `rabbitmq-env-conf.bat` parsing
Due to how the `echo` statement adds a space character, the output
marker was not found while parsing the output of
`rabbitmq-env-conf.bat`. This, in turn, resulted in _none_ of the
environment variables defined there being re-exported.

In addition, the parsing of the output did not succeed as the default is
to expect `sh`-style output.

It is rare for users to use this file on Windows which is how this
behavior has not been noticed in years.

Related to:
* https://pivotal-esc.atlassian.net/browse/VESC-1077
* https://vmware.slack.com/archives/C0RDGG81Z/p1689274725888439
* https://github.com/rabbitmq/rabbitmq-server/pull/5486 (tangentially related)

Add some simple win32 parsing tests
2023-07-19 08:50:55 -07:00
Jean-Sébastien Pédron 8bd656c4be
rabbit_mnesia: Only consider feature flags when testing node compatibility
[Why]
Up to RabbitMQ 3.7.x, versions were compared to determine if two nodes
were compatible. In 3.8.0, feature flags were introduced to fulfill this
check.

The current branch of RabbitMQ is no longer compatible with 3.7.x
because several feature flags are now required. This means the user must
upgrade to intermediate versions first before.

Therefore, we don't need to keep comparing versions.

[How]
The check is now simply calling the feature flags subsystem check.

We still keep versions comparison for plugins. However, we can get rid
of the special case for RabbitMQ 3.6.6.
2023-07-07 09:42:31 +02:00
Michal Kuratczyk 8652403d2b
Exclude shake128/256 from a test 2023-04-13 14:37:18 +02:00
Luke Bakken d9d6e1bef6
Move rabbit_password to rabbit_common
This allows `rabbitmqctl hash_password` to run without having RabbitMQ up.

Follow-up to:
* #5957
* #7003
2023-02-25 09:53:46 -08:00
Alex Valiushko db99c252a0 Add setting to disable op policy edit via API 2023-02-06 14:36:10 -08:00
Michael Klishin ec4f1dba7d
(c) year bump: 2022 => 2023 2023-01-01 23:17:36 -05:00
Rin Kuryloski 344e4553ba Fix rabbit_misc:hexify/1 when called with a list 2022-12-02 09:13:47 +01:00
Jean-Sébastien Pédron 99b14fd0fa
rabbit_env: Rename `mnesia_*dir` to `data_*dir`
The location and name of this directory remains the same for
compatibility reasons. Therefore, it sill contains "mnesia" in its name.
However, semantically, we want this directory to be unrelated to Mnesia.

In the end, many subsystems write files and directories there, including
Mnesia, all Ra systems and in the future, Khepri.
2022-11-30 13:00:49 +01:00
Jean-Sébastien Pédron e0b4bce4f4
rabbit_env: Rename `data_dir` to `home_dir`
This value is used internally by `rabbit_env` and usually not read by
RabbitMQ otherwise.

This patch prepares the rename of `mnesia_dir` to `data_dir`, in order
to not semantically rely on Mnesia configuration or use to locate data,
whether it is stored in Mnesia or not.
2022-11-30 13:00:45 +01:00
Luke Bakken 7fe159edef
Yolo-replace format strings
Replaces `~s` and `~p` with their unicode-friendly counterparts.

```
git ls-files *.erl | xargs sed -i.ORIG -e s/~s>/~ts/g -e s/~p>/~tp/g
```
2022-10-10 10:32:03 +04:00
Jean-Sébastien Pédron 4b132daaba
Remove upgrade-specific log file
This category should be unused with the decommissioning of the old
upgrade subsystem (in favor of the feature flags subsystem). It means:
1. The upgrade log file will not be created by default anymore.
2. The `$RABBITMQ_UPGRADE_LOG` environment variable is now unsupported.

The configuration variables remain to avoid breaking an existing and
working configuration.
2022-10-06 21:28:50 +02:00
Michael Klishin ab5eeb745c
Merge pull request #5659 from Ayanda-D/allow-ignoring-supervisor2-error-reports
Controllable way to ignore supervisor2 error reports
2022-08-29 02:13:57 +04:00
Ayanda Dube 55526755ec Ensure clean shutdown of rabbit_event manager in supervisor2_SUITE to avoid noisy test terminations 2022-08-28 22:45:52 +01:00
Ayanda Dube f10f81bf90 Rename TRACE_SUP2 to TRACE_SUPERVISOR2 and add to Makefile 2022-08-28 22:41:54 +01:00
Ayanda Dube 80f2116935 Use local include to reference rabbit.hrl in test_event_handler 2022-08-28 19:52:44 +01:00
Michael Klishin cb7d840700 Basic unit tests for rabbit_date_time 2022-08-28 14:43:35 +04:00
Ayanda Dube be6c188d64 Implement tests for controlling supervisor2 error reports.
Tests behaviour controlled at compile time through, macro.
2022-08-26 18:35:47 +01:00
Ayanda Dube fa508aca99 Add a test_event_handler for rabbit_common event based tests 2022-08-26 18:30:37 +01:00
Michael Klishin c38a3d697d
Bump (c) year 2022-03-21 01:21:56 +04:00
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
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 0617419e75
This *is* a Unicode character, U+060E 2021-07-28 19:04:16 +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
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
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
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
Michael Klishin caddfd3791
Skip aes_ige256 in config value encryption/decryption tests
it is not supported by some libcrypto versions, including CI.

See [1][2].

1. https://github.com/rabbitmq/credentials-obfuscation/pull/10/files
2. https://bugs.erlang.org/browse/ERL-1478
2021-02-07 23:05:27 +03:00
Michael Klishin 52479099ec
Bump (c) year 2021-01-22 09:00:14 +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 b87898185b Take stream queue dir into account
For rabbit_env suite.
2020-09-30 14:41:59 +01: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 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
Michael Klishin d1f27b08b8 Drive by change: squash a compiler warning 2020-07-14 03:50:09 +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