File rabbitmq-server-3.7.17-stacktrace.patch of Package rabbitmq-server
diff -Ndurp rabbitmq-server-3.7.17/src/rabbit.erl rabbitmq-server-3.7.17-stacktrace/src/rabbit.erl
--- rabbitmq-server-3.7.17/src/rabbit.erl 2019-07-08 03:21:22.000000000 +0300
+++ rabbitmq-server-3.7.17-stacktrace/src/rabbit.erl 2024-04-27 17:43:05.764578725 +0300
@@ -490,8 +490,8 @@ start_it(StartFun) ->
true -> ok;
false -> StartFun()
end
- catch Class:Reason ->
- boot_error(Class, Reason)
+ catch Class:Reason:Stacktrace ->
+ boot_error(Class, Reason, Stacktrace)
after
unlink(Marker),
Marker ! stop,
@@ -958,9 +958,9 @@ stop(_State) ->
end,
ok.
--spec boot_error(term(), not_available | [tuple()]) -> no_return().
+-spec boot_error(term(), not_available | [tuple()], [tuple()]) -> no_return().
-boot_error(_, {could_not_start, rabbit, {{timeout_waiting_for_tables, _}, _}}) ->
+boot_error(_, {could_not_start, rabbit, {{timeout_waiting_for_tables, _}, _}}, _) ->
AllNodes = rabbit_mnesia:cluster_nodes(all),
Suffix = "~nBACKGROUND~n==========~n~n"
"This cluster node was shut down while other nodes were still running.~n"
@@ -980,31 +980,30 @@ boot_error(_, {could_not_start, rabbit,
log_boot_error_and_exit(
timeout_waiting_for_tables,
"~n" ++ Err ++ rabbit_nodes:diagnostics(Nodes), []);
-boot_error(_, {error, {cannot_log_to_file, unknown, Reason}}) ->
+boot_error(_, {error, {cannot_log_to_file, unknown, Reason}}, _) ->
log_boot_error_and_exit(could_not_initialise_logger,
"failed to initialised logger: ~p~n",
[Reason]);
-boot_error(_, {error, {cannot_log_to_file, LogFile,
- {cannot_create_parent_dirs, _, Reason}}}) ->
+boot_error(_, {error, {cannot_log_to_file, LogFile, {cannot_create_parent_dirs, _, Reason}}}, _) ->
log_boot_error_and_exit(could_not_initialise_logger,
"failed to create parent directory for log file at '~s', reason: ~p~n",
[LogFile, Reason]);
-boot_error(_, {error, {cannot_log_to_file, LogFile, Reason}}) ->
+boot_error(_, {error, {cannot_log_to_file, LogFile, Reason}}, _) ->
log_boot_error_and_exit(could_not_initialise_logger,
"failed to open log file at '~s', reason: ~p~n",
[LogFile, Reason]);
-boot_error(_, {error, {generate_config_file, Error}}) ->
+boot_error(_, {error, {generate_config_file, Error}}, _) ->
log_boot_error_and_exit(generate_config_file,
"~nConfig file generation failed:~n~s~n",
[Error]);
-boot_error(Class, Reason) ->
+boot_error(Class, Reason, Stacktrace) ->
LogLocations = log_locations(),
log_boot_error_and_exit(
Reason,
"~nError description:~s"
"~nLog file(s) (may contain more information):~n" ++
lists:flatten([" ~s~n" || _ <- lists:seq(1, length(LogLocations))]),
- [lager:pr_stacktrace(erlang:get_stacktrace(), {Class, Reason})] ++
+ [lager:pr_stacktrace(Stacktrace, {Class, Reason})] ++
LogLocations).
-spec log_boot_error_and_exit(_, _, _) -> no_return().
diff -Ndurp rabbitmq-server-3.7.17/src/rabbit_feature_flags.erl rabbitmq-server-3.7.17-stacktrace/src/rabbit_feature_flags.erl
--- rabbitmq-server-3.7.17/src/rabbit_feature_flags.erl 2019-07-08 03:21:22.000000000 +0300
+++ rabbitmq-server-3.7.17-stacktrace/src/rabbit_feature_flags.erl 2024-04-27 17:42:39.141148538 +0300
@@ -959,8 +959,7 @@ module_attributes_from_testsuite() ->
try
throw(force_exception)
catch
- throw:force_exception ->
- Stacktrace = erlang:get_stacktrace(),
+ throw:force_exception:Stacktrace ->
Modules = lists:filter(
fun({Mod, _, _, _}) ->
ModS = atom_to_list(Mod),
@@ -1490,8 +1489,7 @@ run_migration_fun(FeatureName, FeaturePr
MigrationFun,
[FeatureName, FeatureProps, Arg])
catch
- _:Reason ->
- Stacktrace = erlang:get_stacktrace(),
+ _:Reason:Stacktrace ->
rabbit_log:error("Feature flag `~s`: migration function "
"crashed: ~p~n~p",
[FeatureName, Reason, Stacktrace]),
diff -Ndurp rabbitmq-server-3.7.17/src/rabbit_sysmon_handler.erl rabbitmq-server-3.7.17-stacktrace/src/rabbit_sysmon_handler.erl
--- rabbitmq-server-3.7.17/src/rabbit_sysmon_handler.erl 2019-07-08 03:21:22.000000000 +0300
+++ rabbitmq-server-3.7.17-stacktrace/src/rabbit_sysmon_handler.erl 2024-04-27 17:41:31.798589847 +0300
@@ -179,8 +179,7 @@ format_pretty_proc_or_port_info(PidOrPor
Res ->
Res
end
- catch C:E ->
- S = erlang:get_stacktrace(),
+ catch C:E:S ->
Fmt = "Pid ~w, ~W ~W at ~w\n",
Args = [PidOrPort, C, 20, E, 20, S],
{Fmt, Args}