-
Notifications
You must be signed in to change notification settings - Fork 146
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
feat: ExMachina.start/2: return a supervisor from Application callback #434
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We're actually returning the PID for an Agent rather than a supervisor. In addition to being against the erlang callback spec: The function is to return {ok,Pid} or {ok,Pid,State}, where Pid is the pid of the top supervisor and State is any term. If omitted, State defaults to []. If the application is stopped later, State is passed to Module:prep_stop/1. Some tools like phoenix live dashboard will send the application supervisor supervisor-y messages and end up crashing the root application tree. ** (FunctionClauseError) no function clause matching in Agent.Server.handle_call/3 (elixir 1.14.5) lib/agent/server.ex:11: Agent.Server.handle_call(:which_children, {#PID<0.22073.22>, #Reference<0.3953567925.3593732098.137638>}, %{}) (stdlib 3.17) gen_server.erl:721: :gen_server.try_handle_call/4 (stdlib 3.17) gen_server.erl:750: :gen_server.handle_msg/6 (stdlib 3.17) proc_lib.erl:226: :proc_lib.init_p_do_apply/3 Last message (from #PID<0.22073.22>): :which_children This change makes ExMachina return a supervisor with a single child - the ExMachina.Sequence. Have also moved to `use Agent` to get the child_spec/1 for free in ExMachina.Sequence. This has been tested per the tool versions file (1.7.4 + otp 21).
aeruder
force-pushed
the
fix-supervision-tree
branch
from
October 19, 2023 20:44
5ffc340
to
943acc2
Compare
doomspork
approved these changes
Jan 18, 2024
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.
Thank you @aeruder! Now that ExMachina has been transferred to the BEAM Community we'll work on gettin these PRs incorporated and new releases flowing. Thanks again for the contribution!
doomspork
changed the title
ExMachina.start/2: return a supervisor from Application callback
feat: ExMachina.start/2: return a supervisor from Application callback
Jan 18, 2024
doomspork
pushed a commit
that referenced
this pull request
Jan 18, 2024
#434) We're actually returning the PID for an Agent rather than a supervisor. In addition to being against the erlang callback spec: The function is to return {ok,Pid} or {ok,Pid,State}, where Pid is the pid of the top supervisor and State is any term. If omitted, State defaults to []. If the application is stopped later, State is passed to Module:prep_stop/1. Some tools like phoenix live dashboard will send the application supervisor supervisor-y messages and end up crashing the root application tree. ** (FunctionClauseError) no function clause matching in Agent.Server.handle_call/3 (elixir 1.14.5) lib/agent/server.ex:11: Agent.Server.handle_call(:which_children, {#PID<0.22073.22>, #Reference<0.3953567925.3593732098.137638>}, %{}) (stdlib 3.17) gen_server.erl:721: :gen_server.try_handle_call/4 (stdlib 3.17) gen_server.erl:750: :gen_server.handle_msg/6 (stdlib 3.17) proc_lib.erl:226: :proc_lib.init_p_do_apply/3 Last message (from #PID<0.22073.22>): :which_children This change makes ExMachina return a supervisor with a single child - the ExMachina.Sequence. Have also moved to `use Agent` to get the child_spec/1 for free in ExMachina.Sequence. This has been tested per the tool versions file (1.7.4 + otp 21).
doomspork
pushed a commit
that referenced
this pull request
Jan 18, 2024
#434) We're actually returning the PID for an Agent rather than a supervisor. In addition to being against the erlang callback spec: The function is to return {ok,Pid} or {ok,Pid,State}, where Pid is the pid of the top supervisor and State is any term. If omitted, State defaults to []. If the application is stopped later, State is passed to Module:prep_stop/1. Some tools like phoenix live dashboard will send the application supervisor supervisor-y messages and end up crashing the root application tree. ** (FunctionClauseError) no function clause matching in Agent.Server.handle_call/3 (elixir 1.14.5) lib/agent/server.ex:11: Agent.Server.handle_call(:which_children, {#PID<0.22073.22>, #Reference<0.3953567925.3593732098.137638>}, %{}) (stdlib 3.17) gen_server.erl:721: :gen_server.try_handle_call/4 (stdlib 3.17) gen_server.erl:750: :gen_server.handle_msg/6 (stdlib 3.17) proc_lib.erl:226: :proc_lib.init_p_do_apply/3 Last message (from #PID<0.22073.22>): :which_children This change makes ExMachina return a supervisor with a single child - the ExMachina.Sequence. Have also moved to `use Agent` to get the child_spec/1 for free in ExMachina.Sequence. This has been tested per the tool versions file (1.7.4 + otp 21).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
ExMachina.start/2: return a supervisor from Application callback
We're actually returning the PID for an Agent rather than a
supervisor. In addition to being against the erlang callback spec:
Some tools like phoenix live dashboard will send the
application supervisor supervisor-y messages and end up crashing the
root application tree.
This change makes ExMachina return a supervisor with a single child -
the ExMachina.Sequence. Have also moved to
use Agent
to get thechild_spec/1 for free in ExMachina.Sequence.
This has been tested per the tool versions file (1.7.4 + otp 21).
Before
Afterwards
Tests