Skip to content

Commit 8ce1f32

Browse files
Avoid using erlang:get_stacktrace/0 for improved OTP 23/24 compat
1 parent 9a01982 commit 8ce1f32

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

src/rabbit_channel.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,8 +647,8 @@ handle_cast({method, Method, Content, Flow},
647647
exit:Reason = #amqp_error{} ->
648648
MethodName = rabbit_misc:method_record_type(Method),
649649
handle_exception(Reason#amqp_error{method = MethodName}, State);
650-
_:Reason ->
651-
{stop, {Reason, erlang:get_stacktrace()}, State}
650+
_:Reason:Stacktrace ->
651+
{stop, {Reason, Stacktrace}, State}
652652
end;
653653

654654
handle_cast(ready_for_close,

src/rabbit_node_monitor.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,10 +748,10 @@ register_outside_app_process(Fun, WaitForExistingProcess) ->
748748
do_run_outside_app_fun(Fun) ->
749749
try
750750
Fun()
751-
catch _:E ->
751+
catch _:E:Stacktrace ->
752752
rabbit_log:error(
753753
"rabbit_outside_app_process:~n~p~n~p~n",
754-
[E, erlang:get_stacktrace()])
754+
[E, Stacktrace])
755755
end.
756756

757757
wait_for_cluster_recovery(Condition) ->

src/rabbit_reader.erl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,9 +1139,8 @@ handle_method0(MethodName, FieldsBin,
11391139
throw({connection_closed_abruptly, State});
11401140
exit:#amqp_error{method = none} = Reason ->
11411141
handle_exception(State, 0, Reason#amqp_error{method = MethodName});
1142-
Type:Reason ->
1143-
Stack = erlang:get_stacktrace(),
1144-
handle_exception(State, 0, {Type, Reason, MethodName, Stack})
1142+
Type:Reason:Stacktrace ->
1143+
handle_exception(State, 0, {Type, Reason, MethodName, Stacktrace})
11451144
end.
11461145

11471146
handle_method0(#'connection.start_ok'{mechanism = Mechanism,

src/rabbit_vhost_process.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ init([VHost]) ->
5959
timer:send_interval(Interval, check_vhost),
6060
true = erlang:garbage_collect(),
6161
{ok, VHost}
62-
catch _:Reason ->
62+
catch _:Reason:Stacktrace ->
6363
rabbit_amqqueue:mark_local_durable_queues_stopped(VHost),
6464
rabbit_log:error("Unable to recover vhost ~p data. Reason ~p~n"
6565
" Stacktrace ~p",
66-
[VHost, Reason, erlang:get_stacktrace()]),
66+
[VHost, Reason, Stacktrace]),
6767
{stop, Reason}
6868
end.
6969

0 commit comments

Comments
 (0)