-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support timeout for stopping pools #55
base: main-0.5.x
Are you sure you want to change the base?
Conversation
bdfff99
to
6293cdf
Compare
src/ecpool_sup.erl
Outdated
case process_info(Pid, [dictionary, status, current_function]) of | ||
[{dictionary, Dicts}, {status, Status}, {current_function, CurrFunc}] -> | ||
case proplists:get_value('$initial_call', Dicts) of | ||
{supervisor, ecpool_pool_sup, _} -> | ||
case {Status, CurrFunc} of | ||
{waiting, {proc_lib, _, _}} -> | ||
{ok, Pid}; | ||
_ -> | ||
{error, not_stuck_in_start} | ||
end; | ||
_ -> | ||
search_ecpool_pool_sup_process(Rest) | ||
end; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is too error-prone, can we force the potential processes to be killed with a special key in processes dictionary ?
e.g. put('$ecpool_force_kill', true)
.
and with a OTP_RELEASE compile switch, we can use process label for the same purpose.
https://www.erlang.org/doc/apps/stdlib/proc_lib.html#set_label/1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I want to only kill the ecpool_pool_sup
processes stuck in its init()
callbacks.
In this case it should be calling proc_lib:sync_start/2
(OTP 26+) or proc_lib:sync_start_link/2
(OTP 24), so I'd like to match {current_function, [{proc_lib, _, _}]}
here.
5530c1d
to
7fec061
Compare
No description provided.