Skip to content
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

Match error while doing process handoff in dynamic supervisor #254

Open
flaviogrossi opened this issue Aug 29, 2022 · 0 comments
Open

Match error while doing process handoff in dynamic supervisor #254

flaviogrossi opened this issue Aug 29, 2022 · 0 comments

Comments

@flaviogrossi
Copy link
Contributor

I think there is a missing nil check here while the dynamic supervisor handles the process handoff when a cluster node goes down.

The function get_item/2 can in fact return nil, which should be handled to avoid crashing the caller.

This is an error trace to clarify the case:

** (MatchError) no match of right hand side value: nil
   (horde 0.8.4) lib/horde/dynamic_supervisor_impl.ex:219: Horde.DynamicSupervisorImpl.handle_cast/2
   (stdlib 3.15.2) gen_server.erl:695: :gen_server.try_dispatch/4
   (stdlib 3.15.2) gen_server.erl:771: :gen_server.handle_msg/6
   (stdlib 3.15.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: {:\"$gen_cast\", {:relinquish_child_process, 326189823806954505632234248165147259649}}" tags=default pid=<0.5768.185> module=gen_server function=error_info/7 file=gen_server.erl line=949 vm_pid=1942 host=vm1-3vqpiro-39 erl_level=error crash_reason="{%MatchError{term: nil}, [{Horde.DynamicSupervisorImpl, :handle_cast, 2, [file: 'lib/horde/dynamic_supervisor_impl.ex', line: 219]}, {:gen_server, :try_dispatch, 4, [file: 'gen_server.erl', line: 695]}, {:gen_server, :handle_msg, 6, [file: 'gen_server.erl', line: 771]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 226]}]}" domain=[:otp] error_logger="%{report_cb: &:gen_server.format_log/1, tag: :error}" gl=<0.3031.0> mfa="{:gen_server, :error_info, 7}"

I cannot reliably reproduce the issue, but maybe the whole handle_cast should be just be a noop in case get_item returns nil?

Quickly scanning the file, a similar pattern can also occur in the handoff_child function i believe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant