Skip to content

Commit bb608f4

Browse files
committed
Merge branch 'master' into rabbitmq-server-995
2 parents 67c9b9c + 27bf1d6 commit bb608f4

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

src/rabbit_networking.erl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,16 @@ emit_connection_info_local(Items, Ref, AggregatorPid) ->
328328
connections_local()).
329329

330330
close_connection(Pid, Explanation) ->
331-
rabbit_log:info("Closing connection ~p because ~p~n", [Pid, Explanation]),
332331
case lists:member(Pid, connections()) of
333-
true -> rabbit_reader:shutdown(Pid, Explanation);
334-
false -> throw({error, {not_a_connection_pid, Pid}})
332+
true ->
333+
Res = rabbit_reader:shutdown(Pid, Explanation),
334+
rabbit_log:info("Closing connection ~p because ~p~n", [Pid, Explanation]),
335+
Res;
336+
false ->
337+
rabbit_log:warning("Asked to close connection ~p (reason: ~p) "
338+
"but no running cluster node reported it as an active connection. Was it already closed? ~n",
339+
[Pid, Explanation]),
340+
ok
335341
end.
336342

337343
force_connection_event_refresh(Ref) ->

src/rabbit_vm.erl

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,11 @@ memory() ->
6161
erlang:memory([total, processes, ets, atom, binary, code, system]),
6262

6363
Strategy = vm_memory_monitor:get_memory_calculation_strategy(),
64-
{Allocated, VMTotal} = case Strategy of
65-
erlang -> {ErlangTotal, ErlangTotal};
66-
allocated ->
67-
Alloc = recon_alloc:memory(allocated),
68-
{Alloc, Alloc};
69-
rss ->
70-
Alloc = recon_alloc:memory(allocated),
71-
Vm = vm_memory_monitor:get_process_memory(current),
72-
{Alloc, Vm}
73-
end,
64+
Allocated = recon_alloc:memory(allocated),
65+
Rss = vm_memory_monitor:get_rss_memory(),
7466

7567
AllocatedUnused = max(Allocated - ErlangTotal, 0),
76-
OSReserved = max(VMTotal - Allocated, 0),
68+
OSReserved = max(Rss - Allocated, 0),
7769

7870
OtherProc = Processes
7971
- ConnsReader - ConnsWriter - ConnsChannel - ConnsOther
@@ -112,7 +104,10 @@ memory() ->
112104
{other_system, System - ETS - Bin - Code - Atom},
113105
{allocated_unused, AllocatedUnused},
114106
{reserved_unallocated, OSReserved},
115-
{total, VMTotal}
107+
{strategy, Strategy},
108+
{total, [{erlang, ErlangTotal},
109+
{rss, Rss},
110+
{allocated, Allocated}]}
116111
].
117112
%% [1] - erlang:memory(processes) can be less than the sum of its
118113
%% parts. Rather than display something nonsensical, just silence any

0 commit comments

Comments
 (0)