From b85baea5b6186bf6a8f8e325c10a9f1905722499 Mon Sep 17 00:00:00 2001 From: bas0N Date: Tue, 18 Nov 2025 02:16:53 +0100 Subject: [PATCH 1/5] Fix UTF-8 encoding for trace file downloads Set charset=utf-8 in Content-Type header to ensure proper display of Cyrillic and other Unicode characters in browsers. Fixes #13952 (cherry picked from commit 8795c5dff9d276ab213b1f95330994a8dc9ebfe6) --- .../src/rabbit_tracing_wm_file.erl | 5 ++- .../test/rabbit_tracing_SUITE.erl | 32 ++++++++++++++++++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/deps/rabbitmq_tracing/src/rabbit_tracing_wm_file.erl b/deps/rabbitmq_tracing/src/rabbit_tracing_wm_file.erl index 5beec3a6e40a..2a7f1451bc1b 100644 --- a/deps/rabbitmq_tracing/src/rabbit_tracing_wm_file.erl +++ b/deps/rabbitmq_tracing/src/rabbit_tracing_wm_file.erl @@ -34,7 +34,10 @@ serve(ReqData, Context) -> Content = rabbit_tracing_util:apply_on_node(ReqData, Context, rabbit_tracing_wm_file, serve, [Name]), - {Content, ReqData, Context}. + ReqWithCharset = cowboy_req:set_resp_header(<<"content-type">>, + <<"text/plain; charset=utf-8">>, + ReqData), + {Content, ReqWithCharset, Context}. serve(Name) -> Path = rabbit_tracing_files:full_path(Name), diff --git a/deps/rabbitmq_tracing/test/rabbit_tracing_SUITE.erl b/deps/rabbitmq_tracing/test/rabbit_tracing_SUITE.erl index 534777103c58..88ebee3b4c09 100644 --- a/deps/rabbitmq_tracing/test/rabbit_tracing_SUITE.erl +++ b/deps/rabbitmq_tracing/test/rabbit_tracing_SUITE.erl @@ -24,7 +24,8 @@ groups() -> [ {non_parallel_tests, [], [ tracing_test, - tracing_validation_test + tracing_validation_test, + trace_file_content_type_test ]} ]. @@ -128,6 +129,35 @@ tracing_validation_test(Config) -> http_delete(Config, Path, ?NO_CONTENT), ok. +trace_file_content_type_test(Config) -> + case filelib:is_dir(?LOG_DIR) of + true -> {ok, Files} = file:list_dir(?LOG_DIR), + [ok = file:delete(?LOG_DIR ++ F) || F <- Files]; + _ -> ok + end, + + Args = #{format => <<"text">>, + pattern => <<"#">>}, + http_put(Config, "/traces/%2f/test-charset", Args, ?CREATED), + + Ch = rabbit_ct_client_helpers:open_channel(Config), + amqp_channel:cast(Ch, #'basic.publish'{ exchange = <<"amq.topic">>, + routing_key = <<"key">> }, + #amqp_msg{props = #'P_basic'{}, + payload = <<"Test message">>}), + rabbit_ct_client_helpers:close_channel(Ch), + + timer:sleep(100), + + http_delete(Config, "/traces/%2f/test-charset", ?NO_CONTENT), + {ok, {{_HTTP, 200, _}, Headers, _Body}} = + req(Config, get, "/trace-files/test-charset.log", [auth_header("guest", "guest")]), + ContentType = proplists:get_value("content-type", Headers), + ?assertEqual(match, re:run(ContentType, "text/plain", [{capture, none}])), + ?assertEqual(match, re:run(ContentType, "charset=utf-8", [{capture, none}])), + http_delete(Config, "/trace-files/test-charset.log", ?NO_CONTENT), + ok. + %%--------------------------------------------------------------------------- %% TODO: Below is copied from rabbit_mgmt_test_http, %% should be moved to use rabbit_mgmt_test_util once rabbitmq_management From 767212d00f566e5140659ce7443c39d7c43990a2 Mon Sep 17 00:00:00 2001 From: bas0N Date: Tue, 18 Nov 2025 02:36:22 +0100 Subject: [PATCH 2/5] Add release note for UTF-8 encoding fix in trace files (cherry picked from commit be75522572d90881d661fae3aa588135606a25e0) # Conflicts: # release-notes/4.3.0.md --- release-notes/4.3.0.md | 193 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 release-notes/4.3.0.md diff --git a/release-notes/4.3.0.md b/release-notes/4.3.0.md new file mode 100644 index 000000000000..78fada04d35e --- /dev/null +++ b/release-notes/4.3.0.md @@ -0,0 +1,193 @@ +## RabbitMQ 4.3.0 + +RabbitMQ `4.3.0` is a new feature release. + + +## Breaking Changes and Compatibility Notes + +### Classic Queues v1 Storage (CQv1) is Removed + +This release removes the original classic queue storage implementation these days +known as CQv1. A 2nd generation implementation called CQv2 has been adopted +as the default starting with `4.2.0`. + +This means that attemptes to declare a queue using the following [optional queue arguments](https://www.rabbitmq.com/docs/queues#optional-arguments) will fail: + + * `x-queue-mode` set to any value + * `x-queue-version` set to `1` + +Existing classic queues upgraded to CQv2 during an earlier upgrade to `4.2.x` will continue +operating as usual. + + +## Release Highlights + +TBD + + +## Upgrading to 4.3.0 + +### Documentation guides on upgrades + +See the [Upgrading guide](https://www.rabbitmq.com/docs/upgrade) for documentation on upgrades and [GitHub releases](https://github.com/rabbitmq/rabbitmq-server/releases) +for release notes of individual releases. + +This release series supports upgrades from `4.2.x`. Upgrades from earlier series are **not** supported: +users must upgrade to the latest available `4.2.x` patch release before upgrading to `4.3.0`. + + +### New Required Feature Flags + +All feature flags introduced in `4.2.0` and earlier are required, including the following: +* `rabbitmq_4.2.0` +* `rabbitmq_4.1.0` +* `rabbitmq_4.0.0` +* `khepri_db` +* `quorum_queue_non_voters` +* `message_containers_deaths_v2` + +Enable all required feature flags before upgrading to `4.3.0`. + +If your RabbitMQ cluster had plugin `rabbitmq_amqp1_0` enabled in RabbitMQ `3.13.x` (and your cluster still serves AMQP 1.0 client connections in `4.x`), your cluster should do at least one rolling update **after** enabling feature flag `rabbitmq_4.0.0` but **before** upgrading to `4.3.0`. + +### Deprecated Features + +In `4.3.0` the deprecation phase of the following features advanced from `permitted_by_default` to `denied_by_default`: +* `amqp_filter_set_bug` + +### Mixed version cluster compatibility + +RabbitMQ 4.3.0 nodes can run alongside `4.2.x`. + +Mixed version clusters are a mechanism that allows rolling upgrade and are not meant to be run for extended +periods of time (no more than a few hours). + +### Recommended Post-upgrade Procedures + +This version does not require any additional post-upgrade procedures +compared to other versions. + + +## Changes Worth Mentioning + +### Core Server + +#### Bug Fixes + + * Quorum queue at-most-once dead lettering for the overflow behaviour `drop-head` now happens in the correct order. + + GitHub issue: [#14926](https://github.com/rabbitmq/rabbitmq-server/pull/14926) + + * Feature flag state in the registry and on disk were not consistent for a period of time during node boot. + + GitHub issue: [#14943](https://github.com/rabbitmq/rabbitmq-server/pull/14943) + + +### Stream Plugin + +#### Bug Fixes + + * `stream.read_ahead` is a new setting that controls how much data is prefetched from disk + for stream reads (consumption). + + GitHub issue: [#14948/](https://github.com/rabbitmq/rabbitmq-server/pull/14948) + + * Stream deletion is now more resilient and can handle certain mid-deletion failure scenarios. + + GitHub issue: [#14852](https://github.com/rabbitmq/rabbitmq-server/issues/14852) + + +### Grafana Dashboards + +#### Enhancements + + * The [dashboards](https://grafana.com/orgs/rabbitmq) were updated for the most recent RabbitMQ release series. + + +### Management Plugin + +#### Enhancements + + * `GET /api/queues/{vhost}` requests no longer perform unnecessary virtual host permission checks + and log less (at `debug` level) as a result. + + GitHub issue: [#14923](https://github.com/rabbitmq/rabbitmq-server/discussions/14923) + + +### Tracing Plugin + +#### Bug Fixes + + * Trace file downloads now correctly display Cyrillic and other Unicode characters in browsers + by setting `charset=utf-8` in the `Content-Type` header. + + GitHub issue: [#13952](https://github.com/rabbitmq/rabbitmq-server/issues/13952) + + +### Shovel Plugin + +#### Bug Fixes + + * Improved target node resource alarm handling for AMQP 1.0 and local shovels. + + GitHub issue: [#14886](https://github.com/rabbitmq/rabbitmq-server/pull/14886) + + * Local shovels could run into an exception that would cause a shovel restart. + + GitHub issue: [#14872](https://github.com/rabbitmq/rabbitmq-server/pull/14872) + + * AMQP 1.0 shovels ignored the `sasl` URI parameter. + + GitHub issue: [#14867](https://github.com/rabbitmq/rabbitmq-server/pull/14867) + + +### OAuth 2 Plugin + +#### Bug Fixes + + * A usability improvement allows the plugin to automatically load the trusted system x.509 (TLS) certificates. + + GitHub issue: [#14927](https://github.com/rabbitmq/rabbitmq-server/pull/14927) + + +### LDAP Plugin + +#### Enhancements + + * LDAP queries, including multi-line ones, now can be specified in `rabbitmq.conf`. + + GitHub issue: [#14868](https://github.com/rabbitmq/rabbitmq-server/pull/14868) + +#### Bug Fixes + + * A usability improvement allows the plugin to automatically load the trusted system certificates + when the user only enables TLS for the LDAP client but does not configure any other settings. + + GitHub issue: [#14937](https://github.com/rabbitmq/rabbitmq-server/pull/14937) + + +### HTTP Auth Backend Plugin + +#### Enhancements + + * The HTTP Auth Backend can now optionally provide a custom authorization denial reason to AMQP clients. + + To opt in, return `deny ` (instead of only `deny`) in the HTTP response body of your HTTP auth backend and set the following in your `rabbitmq.conf` file: + +```ini +auth_http.authorization_failure_disclosure = true +``` + + See the [README](https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_auth_backend_http/README.md) for more information. + + GitHub issue: [#14641](https://github.com/rabbitmq/rabbitmq-server/pull/14641) + + +### Dependency Changes + + * `cuttlefish` was upgraded to [`3.6.0`](https://github.com/kyorai/cuttlefish/releases) + +## Source Code Archives + +To obtain source code of the entire distribution, please download the archive named `rabbitmq-server-4.3.0.tar.xz` +instead of the source tarball produced by GitHub. From a6c74ecaed8e488a2e19b0b701b6db710a7b82b3 Mon Sep 17 00:00:00 2001 From: bas0N Date: Tue, 18 Nov 2025 16:41:32 +0100 Subject: [PATCH 3/5] Fix tests and improve test helpers in rabbitmq_tracing - Replace timer:sleep(100) with await_condition/1 to wait for trace files instead of using fixed delays, making tests more reliable - Remove explicit close_channel calls for managed CT helper channels - Add http_get_headers/5 helper function following the same pattern as http_get/5 and http_get_raw/5, replacing direct req/4 calls - Use helper function to validate HTTP status codes and return headers consistently with the module's existing helper pattern (cherry picked from commit b606cc068287e3ec20108a60f1f63edd7b0f5a8e) --- .../test/rabbit_tracing_SUITE.erl | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/deps/rabbitmq_tracing/test/rabbit_tracing_SUITE.erl b/deps/rabbitmq_tracing/test/rabbit_tracing_SUITE.erl index 88ebee3b4c09..8bc185b071fb 100644 --- a/deps/rabbitmq_tracing/test/rabbit_tracing_SUITE.erl +++ b/deps/rabbitmq_tracing/test/rabbit_tracing_SUITE.erl @@ -93,9 +93,10 @@ tracing_test(Config) -> #amqp_msg{props = #'P_basic'{}, payload = <<"Hello world">>}), - rabbit_ct_client_helpers:close_channel(Ch), - - timer:sleep(100), + rabbit_ct_helpers:await_condition(fun() -> + TraceFiles = http_get(Config, "/trace-files/"), + lists:any(fun(#{name := Name}) -> Name =:= <<"test.log">> end, TraceFiles) + end), http_delete(Config, "/traces/%2f/test", ?NO_CONTENT), [] = http_get(Config, "/traces/%2f/"), @@ -145,13 +146,14 @@ trace_file_content_type_test(Config) -> routing_key = <<"key">> }, #amqp_msg{props = #'P_basic'{}, payload = <<"Test message">>}), - rabbit_ct_client_helpers:close_channel(Ch), - timer:sleep(100), + rabbit_ct_helpers:await_condition(fun() -> + TraceFiles = http_get(Config, "/trace-files/"), + lists:any(fun(#{name := Name}) -> Name =:= <<"test-charset.log">> end, TraceFiles) + end), http_delete(Config, "/traces/%2f/test-charset", ?NO_CONTENT), - {ok, {{_HTTP, 200, _}, Headers, _Body}} = - req(Config, get, "/trace-files/test-charset.log", [auth_header("guest", "guest")]), + Headers = http_get_headers(Config, "/trace-files/test-charset.log"), ContentType = proplists:get_value("content-type", Headers), ?assertEqual(match, re:run(ContentType, "text/plain", [{capture, none}])), ?assertEqual(match, re:run(ContentType, "charset=utf-8", [{capture, none}])), @@ -184,6 +186,15 @@ http_get_raw(Config, Path, User, Pass, CodeExp) -> assert_code(CodeExp, CodeAct, "GET", Path, ResBody), ResBody. +http_get_headers(Config, Path) -> + http_get_headers(Config, Path, "guest", "guest", ?OK). + +http_get_headers(Config, Path, User, Pass, CodeExp) -> + {ok, {{_HTTP, CodeAct, _}, Headers, ResBody}} = + req(Config, get, Path, [auth_header(User, Pass)]), + assert_code(CodeExp, CodeAct, "GET", Path, ResBody), + Headers. + http_put(Config, Path, List, CodeExp) -> http_put_raw(Config, Path, format_for_upload(List), CodeExp). From 1fc11e9f8de46dabf091af9acaf7aeace3db73db Mon Sep 17 00:00:00 2001 From: bas0N Date: Tue, 18 Nov 2025 16:56:16 +0100 Subject: [PATCH 4/5] Use charsets_provided callback for charset negotiation Replace manual header setting with charsets_provided/2 callback to let Cowboy handle charset negotiation automatically. (cherry picked from commit c1cc4952310524035c4887245d04c03311664ffb) --- deps/rabbitmq_tracing/src/rabbit_tracing_wm_file.erl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/deps/rabbitmq_tracing/src/rabbit_tracing_wm_file.erl b/deps/rabbitmq_tracing/src/rabbit_tracing_wm_file.erl index 2a7f1451bc1b..daa0aeb3c065 100644 --- a/deps/rabbitmq_tracing/src/rabbit_tracing_wm_file.erl +++ b/deps/rabbitmq_tracing/src/rabbit_tracing_wm_file.erl @@ -7,7 +7,7 @@ -module(rabbit_tracing_wm_file). -export([init/2, resource_exists/2, serve/2, content_types_provided/2, - is_authorized/2, allowed_methods/2, delete_resource/2]). + charsets_provided/2, is_authorized/2, allowed_methods/2, delete_resource/2]). -export([serve/1]). -include_lib("rabbitmq_management_agent/include/rabbit_mgmt_records.hrl"). @@ -20,6 +20,9 @@ init(Req, _State) -> content_types_provided(ReqData, Context) -> {[{<<"text/plain">>, serve}], ReqData, Context}. +charsets_provided(ReqData, Context) -> + {[<<"utf-8">>], ReqData, Context}. + allowed_methods(ReqData, Context) -> {[<<"HEAD">>, <<"GET">>, <<"DELETE">>], ReqData, Context}. @@ -34,10 +37,7 @@ serve(ReqData, Context) -> Content = rabbit_tracing_util:apply_on_node(ReqData, Context, rabbit_tracing_wm_file, serve, [Name]), - ReqWithCharset = cowboy_req:set_resp_header(<<"content-type">>, - <<"text/plain; charset=utf-8">>, - ReqData), - {Content, ReqWithCharset, Context}. + {Content, ReqData, Context}. serve(Name) -> Path = rabbit_tracing_files:full_path(Name), From f5a74541ef75f459b8c94376aacd075c6cd8f658 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Tue, 18 Nov 2025 14:55:00 -0800 Subject: [PATCH 5/5] Resolve a conflict #149966 #14970 --- release-notes/4.3.0.md | 193 ----------------------------------------- 1 file changed, 193 deletions(-) delete mode 100644 release-notes/4.3.0.md diff --git a/release-notes/4.3.0.md b/release-notes/4.3.0.md deleted file mode 100644 index 78fada04d35e..000000000000 --- a/release-notes/4.3.0.md +++ /dev/null @@ -1,193 +0,0 @@ -## RabbitMQ 4.3.0 - -RabbitMQ `4.3.0` is a new feature release. - - -## Breaking Changes and Compatibility Notes - -### Classic Queues v1 Storage (CQv1) is Removed - -This release removes the original classic queue storage implementation these days -known as CQv1. A 2nd generation implementation called CQv2 has been adopted -as the default starting with `4.2.0`. - -This means that attemptes to declare a queue using the following [optional queue arguments](https://www.rabbitmq.com/docs/queues#optional-arguments) will fail: - - * `x-queue-mode` set to any value - * `x-queue-version` set to `1` - -Existing classic queues upgraded to CQv2 during an earlier upgrade to `4.2.x` will continue -operating as usual. - - -## Release Highlights - -TBD - - -## Upgrading to 4.3.0 - -### Documentation guides on upgrades - -See the [Upgrading guide](https://www.rabbitmq.com/docs/upgrade) for documentation on upgrades and [GitHub releases](https://github.com/rabbitmq/rabbitmq-server/releases) -for release notes of individual releases. - -This release series supports upgrades from `4.2.x`. Upgrades from earlier series are **not** supported: -users must upgrade to the latest available `4.2.x` patch release before upgrading to `4.3.0`. - - -### New Required Feature Flags - -All feature flags introduced in `4.2.0` and earlier are required, including the following: -* `rabbitmq_4.2.0` -* `rabbitmq_4.1.0` -* `rabbitmq_4.0.0` -* `khepri_db` -* `quorum_queue_non_voters` -* `message_containers_deaths_v2` - -Enable all required feature flags before upgrading to `4.3.0`. - -If your RabbitMQ cluster had plugin `rabbitmq_amqp1_0` enabled in RabbitMQ `3.13.x` (and your cluster still serves AMQP 1.0 client connections in `4.x`), your cluster should do at least one rolling update **after** enabling feature flag `rabbitmq_4.0.0` but **before** upgrading to `4.3.0`. - -### Deprecated Features - -In `4.3.0` the deprecation phase of the following features advanced from `permitted_by_default` to `denied_by_default`: -* `amqp_filter_set_bug` - -### Mixed version cluster compatibility - -RabbitMQ 4.3.0 nodes can run alongside `4.2.x`. - -Mixed version clusters are a mechanism that allows rolling upgrade and are not meant to be run for extended -periods of time (no more than a few hours). - -### Recommended Post-upgrade Procedures - -This version does not require any additional post-upgrade procedures -compared to other versions. - - -## Changes Worth Mentioning - -### Core Server - -#### Bug Fixes - - * Quorum queue at-most-once dead lettering for the overflow behaviour `drop-head` now happens in the correct order. - - GitHub issue: [#14926](https://github.com/rabbitmq/rabbitmq-server/pull/14926) - - * Feature flag state in the registry and on disk were not consistent for a period of time during node boot. - - GitHub issue: [#14943](https://github.com/rabbitmq/rabbitmq-server/pull/14943) - - -### Stream Plugin - -#### Bug Fixes - - * `stream.read_ahead` is a new setting that controls how much data is prefetched from disk - for stream reads (consumption). - - GitHub issue: [#14948/](https://github.com/rabbitmq/rabbitmq-server/pull/14948) - - * Stream deletion is now more resilient and can handle certain mid-deletion failure scenarios. - - GitHub issue: [#14852](https://github.com/rabbitmq/rabbitmq-server/issues/14852) - - -### Grafana Dashboards - -#### Enhancements - - * The [dashboards](https://grafana.com/orgs/rabbitmq) were updated for the most recent RabbitMQ release series. - - -### Management Plugin - -#### Enhancements - - * `GET /api/queues/{vhost}` requests no longer perform unnecessary virtual host permission checks - and log less (at `debug` level) as a result. - - GitHub issue: [#14923](https://github.com/rabbitmq/rabbitmq-server/discussions/14923) - - -### Tracing Plugin - -#### Bug Fixes - - * Trace file downloads now correctly display Cyrillic and other Unicode characters in browsers - by setting `charset=utf-8` in the `Content-Type` header. - - GitHub issue: [#13952](https://github.com/rabbitmq/rabbitmq-server/issues/13952) - - -### Shovel Plugin - -#### Bug Fixes - - * Improved target node resource alarm handling for AMQP 1.0 and local shovels. - - GitHub issue: [#14886](https://github.com/rabbitmq/rabbitmq-server/pull/14886) - - * Local shovels could run into an exception that would cause a shovel restart. - - GitHub issue: [#14872](https://github.com/rabbitmq/rabbitmq-server/pull/14872) - - * AMQP 1.0 shovels ignored the `sasl` URI parameter. - - GitHub issue: [#14867](https://github.com/rabbitmq/rabbitmq-server/pull/14867) - - -### OAuth 2 Plugin - -#### Bug Fixes - - * A usability improvement allows the plugin to automatically load the trusted system x.509 (TLS) certificates. - - GitHub issue: [#14927](https://github.com/rabbitmq/rabbitmq-server/pull/14927) - - -### LDAP Plugin - -#### Enhancements - - * LDAP queries, including multi-line ones, now can be specified in `rabbitmq.conf`. - - GitHub issue: [#14868](https://github.com/rabbitmq/rabbitmq-server/pull/14868) - -#### Bug Fixes - - * A usability improvement allows the plugin to automatically load the trusted system certificates - when the user only enables TLS for the LDAP client but does not configure any other settings. - - GitHub issue: [#14937](https://github.com/rabbitmq/rabbitmq-server/pull/14937) - - -### HTTP Auth Backend Plugin - -#### Enhancements - - * The HTTP Auth Backend can now optionally provide a custom authorization denial reason to AMQP clients. - - To opt in, return `deny ` (instead of only `deny`) in the HTTP response body of your HTTP auth backend and set the following in your `rabbitmq.conf` file: - -```ini -auth_http.authorization_failure_disclosure = true -``` - - See the [README](https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_auth_backend_http/README.md) for more information. - - GitHub issue: [#14641](https://github.com/rabbitmq/rabbitmq-server/pull/14641) - - -### Dependency Changes - - * `cuttlefish` was upgraded to [`3.6.0`](https://github.com/kyorai/cuttlefish/releases) - -## Source Code Archives - -To obtain source code of the entire distribution, please download the archive named `rabbitmq-server-4.3.0.tar.xz` -instead of the source tarball produced by GitHub.