@@ -2154,6 +2154,7 @@ leader_health_check(QueueNameOrRegEx, VHost) ->
2154
2154
% % we cannot spawn any new processes for executing QQ leader health checks.
2155
2155
ProcessLimitThreshold = round (0.4 * erlang :system_info (process_limit )),
2156
2156
2157
+ ParentPID = self (),
2157
2158
HealthCheckRef = make_ref (),
2158
2159
HealthCheckPids =
2159
2160
lists :flatten (
@@ -2164,12 +2165,13 @@ leader_health_check(QueueNameOrRegEx, VHost) ->
2164
2165
case re :run (QueueName , QueueNameOrRegEx , [{capture , none }]) of
2165
2166
match ->
2166
2167
{ClusterName , _ } = rabbit_amqqueue :pid_of (Q ),
2167
- _Pid = spawn (fun () -> run_leader_health_check (ClusterName , QResource , HealthCheckRef , self () ) end );
2168
+ _Pid = spawn (fun () -> run_leader_health_check (ClusterName , QResource , HealthCheckRef , ParentPID ) end );
2168
2169
_ ->
2169
2170
[]
2170
2171
end ;
2171
2172
false ->
2172
- []
2173
+ rabbit_log :warning (" Leader health check failed from exceeded process limit threshold" ),
2174
+ throw ({error , leader_health_check_process_limit_exceeded })
2173
2175
end
2174
2176
end || Q <- rabbit_amqqueue :list (VHost ), amqqueue :get_type (Q ) == ? MODULE ]),
2175
2177
wait_for_leader_health_checks (HealthCheckRef , length (HealthCheckPids ), []).
@@ -2189,23 +2191,15 @@ wait_for_leader_health_checks(Ref, N, UnhealthyAcc) ->
2189
2191
{ok , Ref , _QResource } when N == 1 ->
2190
2192
UnhealthyAcc ;
2191
2193
{error , Ref , QResource } when N == 1 ->
2192
- [cli_format (QResource ) | UnhealthyAcc ];
2194
+ [amqqueue : to_printable (QResource , ? MODULE ) | UnhealthyAcc ];
2193
2195
{ok , Ref , _QResource } ->
2194
2196
wait_for_leader_health_checks (Ref , N - 1 , UnhealthyAcc );
2195
2197
{error , Ref , QResource } ->
2196
- wait_for_leader_health_checks (Ref , N - 1 , [cli_format (QResource ) | UnhealthyAcc ])
2198
+ wait_for_leader_health_checks (Ref , N - 1 , [amqqueue : to_printable (QResource , ? MODULE ) | UnhealthyAcc ])
2197
2199
after
2198
2200
? QQ_GLOBAL_LEADER_HEALTH_CHECK_TIMEOUT ->
2199
2201
UnhealthyAcc
2200
2202
end .
2201
2203
2202
2204
check_process_limit_safety (ProcessLimitThreshold ) ->
2203
2205
erlang :system_info (process_count ) < ProcessLimitThreshold .
2204
-
2205
- cli_format (QResource = {resource , VHost , queue , QName }) ->
2206
- #{
2207
- <<" readable_name" >> => rabbit_data_coercion :to_binary (rabbit_misc :rs (QResource )),
2208
- <<" name" >> => QName ,
2209
- <<" virtual_host" >> => VHost ,
2210
- <<" type" >> => <<" quorum" >>
2211
- }.
0 commit comments