diff --git a/deps/rabbit/test/unit_file_handle_cache_SUITE.erl b/deps/rabbit/test/unit_file_handle_cache_SUITE.erl index 2e9736ff6655..5ba89315989b 100644 --- a/deps/rabbit/test/unit_file_handle_cache_SUITE.erl +++ b/deps/rabbit/test/unit_file_handle_cache_SUITE.erl @@ -25,7 +25,6 @@ groups() -> [ {non_parallel_tests, [], [ file_handle_cache, %% Change FHC limit. - file_handle_cache_reserve, file_handle_cache_reserve_release, file_handle_cache_reserve_monitor, file_handle_cache_reserve_open_file_above_limit @@ -134,47 +133,6 @@ file_handle_cache1(_Config) -> ok = file_handle_cache:set_limit(Limit), passed. -file_handle_cache_reserve(Config) -> - passed = rabbit_ct_broker_helpers:rpc(Config, 0, - ?MODULE, file_handle_cache_reserve1, [Config]). - -file_handle_cache_reserve1(_Config) -> - Limit = file_handle_cache:get_limit(), - ok = file_handle_cache:set_limit(5), - %% Reserves are always accepted, even if above the limit - %% These are for special processes such as quorum queues - ok = file_handle_cache:set_reservation(7), - - Self = self(), - spawn(fun () -> ok = file_handle_cache:obtain(), - Self ! obtained - end), - - Props = file_handle_cache:info([files_reserved, sockets_used]), - ?assertEqual(7, proplists:get_value(files_reserved, Props)), - ?assertEqual(0, proplists:get_value(sockets_used, Props)), - - %% The obtain should still be blocked, as there are no file handles - %% available - receive - obtained -> - throw(error_file_obtained) - after 1000 -> - %% Let's release 5 file handles, that should leave - %% enough free for the `obtain` to go through - file_handle_cache:set_reservation(2), - Props0 = file_handle_cache:info([files_reserved, sockets_used]), - ?assertEqual(2, proplists:get_value(files_reserved, Props0)), - ?assertEqual(1, proplists:get_value(sockets_used, Props0)), - receive - obtained -> - ok = file_handle_cache:set_limit(Limit), - passed - after 5000 -> - throw(error_file_not_released) - end - end. - file_handle_cache_reserve_release(Config) -> passed = rabbit_ct_broker_helpers:rpc(Config, 0, ?MODULE, file_handle_cache_reserve_release1, [Config]). diff --git a/deps/rabbit_common/src/file_handle_cache.erl b/deps/rabbit_common/src/file_handle_cache.erl index 34247f2a9a5c..53eaa80decab 100644 --- a/deps/rabbit_common/src/file_handle_cache.erl +++ b/deps/rabbit_common/src/file_handle_cache.erl @@ -1087,9 +1087,8 @@ infos(Items, State) -> [{Item, i(Item, State)} || Item <- Items]. i(total_limit, #fhc_state{limit = Limit}) -> Limit; i(total_used, State) -> used(State); -i(sockets_limit, #fhc_state{obtain_limit = Limit}) -> Limit; -i(sockets_used, #fhc_state{obtain_count_socket = Count, - reserve_count_socket = RCount}) -> Count + RCount; +i(sockets_limit, _) -> 0; +i(sockets_used, _) -> 0; i(files_reserved, #fhc_state{reserve_count_file = RCount}) -> RCount; i(Item, _) -> throw({bad_argument, Item}). diff --git a/deps/rabbitmq_management_agent/src/rabbit_mgmt_external_stats.erl b/deps/rabbitmq_management_agent/src/rabbit_mgmt_external_stats.erl index 5d3249a8ed04..6b2b6f55be8e 100644 --- a/deps/rabbitmq_management_agent/src/rabbit_mgmt_external_stats.erl +++ b/deps/rabbitmq_management_agent/src/rabbit_mgmt_external_stats.erl @@ -195,10 +195,11 @@ i(fd_used, State) -> get_used_fd(State); i(fd_total, #state{fd_total = FdTotal}=State) -> {State, FdTotal}; +%% sockets_used and sockets_total are unused since RabbitMQ 4.0. i(sockets_used, State) -> - {State, proplists:get_value(sockets_used, file_handle_cache:info([sockets_used]))}; + {State, 0}; i(sockets_total, State) -> - {State, proplists:get_value(sockets_limit, file_handle_cache:info([sockets_limit]))}; + {State, 0}; i(os_pid, State) -> {State, rabbit_data_coercion:to_utf8_binary(os:getpid())}; i(mem_used, State) ->