@@ -2154,6 +2154,7 @@ leader_health_check(QueueNameOrRegEx, VHost) ->
21542154    % % we cannot spawn any new processes for executing QQ leader health checks.
21552155    ProcessLimitThreshold  =  round (0.4  *  erlang :system_info (process_limit )),
21562156
2157+     ParentPID  =  self (),
21572158    HealthCheckRef  =  make_ref (),
21582159    HealthCheckPids  = 
21592160        lists :flatten (
@@ -2164,12 +2165,13 @@ leader_health_check(QueueNameOrRegEx, VHost) ->
21642165                        case  re :run (QueueName , QueueNameOrRegEx , [{capture , none }]) of 
21652166                            match  ->
21662167                                {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 );
21682169                            _  ->
21692170                                []
21702171                        end ;
21712172                    false  ->
2172-                         []
2173+                         rabbit_log :warning (" Leader health check failed from exceeded process limit threshold" 
2174+                         throw ({error , leader_health_check_process_limit_exceeded })
21732175                end 
21742176            end  || Q  <-  rabbit_amqqueue :list (VHost ), amqqueue :get_type (Q ) ==  ? MODULE ]),
21752177    wait_for_leader_health_checks (HealthCheckRef , length (HealthCheckPids ), []).
@@ -2189,23 +2191,15 @@ wait_for_leader_health_checks(Ref, N, UnhealthyAcc) ->
21892191        {ok , Ref , _QResource } when  N  ==  1  ->
21902192            UnhealthyAcc ;
21912193        {error , Ref , QResource } when  N  ==  1  ->
2192-             [cli_format (QResource ) | UnhealthyAcc ];
2194+             [amqqueue : to_printable (QResource ,  ? MODULE ) | UnhealthyAcc ];
21932195        {ok , Ref , _QResource } ->
21942196            wait_for_leader_health_checks (Ref , N  -  1 , UnhealthyAcc );
21952197        {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 ])
21972199    after 
21982200        ? QQ_GLOBAL_LEADER_HEALTH_CHECK_TIMEOUT  ->
21992201            UnhealthyAcc 
22002202    end .
22012203
22022204check_process_limit_safety (ProcessLimitThreshold ) -> 
22032205    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