DynamicSupervisor - problem with communication with the workers












1















I have a problem with communication with the workers created in my dynamicSupervisor. after start all my workers i try make a call to one by pid and is generated one error (always).
At the beginning of the child I keep the pid with ets. Then when I want to make a call to this child I get the pid from the ets by an identifier. So far so good.
The problem is when I do the following:



GenServer.call(
pid,
{:action_project, %{project_id: project_id, pid: :erlang.pid_to_list(pid)}}
)


returns following error:



[error] GenServer #PID<0.606.0> terminating
** (RuntimeError) attempted to call GenServer #PID<0.606.0> but no handle_call/3 clause was provided
(backercamp) lib/gen_server.ex:693: MyApplication.ProjectWorker.handle_call/3
(stdlib) gen_server.erl:661: :gen_server.try_handle_call/4
(stdlib) gen_server.erl:690: :gen_server.handle_msg/6
(stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.680.0>): {:action_project, %{pid: '<0.606.0>', project_id: "23"}}
State: %{pid: '<0.606.0>', project_id: "23"}
Client #PID<0.680.0> is alive

(stdlib) gen.erl:169: :gen.do_call/4
(elixir) lib/gen_server.ex:921: GenServer.call/3


What's the problem with this call?



DynamicSupervisor code:



defmodule MyApplication.Supervisor do
use DynamicSupervisor

alias MyApplication.Management

def start_link(arg) do
DynamicSupervisor.start_link(__MODULE__, arg, name: __MODULE__)
end

def init(arg) do
DynamicSupervisor.init(arg)
end

def start_project_worker(project_id) do
spec = {MyApplication.ProjectWorker, %{project_id: project_id}}
DynamicSupervisor.start_child(__MODULE__, spec)
end

def start_all_project_workers() do
Enum.each(Management.list_all_projects(), fn %{id: project_id} ->
IO.puts("Started for project Id [#{project_id}]")
# 1s between workers
:timer.sleep(1000)
start_project_worker("#{project_id}")
end)
end

def action_project(pid, project_id) do
GenServer.call(
pid,
{:action_project, %{project_id: project_id, pid: :erlang.pid_to_list(pid)}}
)
end
end


Worker code:



defmodule MyApplication.ProjectWorker do

use GenServer, restart: :transient

alias MyApplication.Settings
alias MyApplication.Management

def start_link(state) do
GenServer.start_link(__MODULE__, state)
end

def init(state) do
schedule_action_project(Settings.get_frequency_ms())
state = Map.put(state, :pid, :erlang.pid_to_list(self()))
persist_state(state)
{:ok, state}
end

def handle_info(:schedule_action_project, %{project_id: _project_id, pid: _pid} = state) do
action_by_state(state)
{:noreply, state}
end

def handle_call({:action_project}, %{project_id: _project_id, pid: _pid} = state) do
case action_by_state(state) do
true ->
terminate(state)

false ->
{:reply, state, state}
end
end

defp persist_state(state) do
IO.puts(" :: Add project_id [#{state.project_id}] and pid #{state.pid}")
:ets.insert_new(:project_backup, {state.project_id, state.pid})
end

defp delete_persist_state(project_id) do
IO.puts(" :: Delete project_id [#{project_id}]")
:ets.delete(:project_backup, project_id)
end

defp schedule_action_project(time) do
IO.puts(" :: Schedule_action_project [#{time}]")
Process.send_after(self(), :schedule_action_project, time)
end

defp terminate(%{project_id: project_id, pid: _pid} = state) do
IO.puts(
" :: Stop processed, everything is done! project_id [#{state.project_id}] and pid #{
state.pid
}"
)

delete_persist_state(project_id)
{:stop, :normal, state}
end

defp action_by_state(%{project_id: _project_id, pid: _pid} = state) do
action_by_project(Management.get_project!(state.project_id))
end

defp action_by_project(%Project{} = project) do
#do something in project
end
end









share|improve this question

























  • What error do you get? Post the stack trace here.

    – Aleksei Matiushkin
    Nov 23 '18 at 11:08
















1















I have a problem with communication with the workers created in my dynamicSupervisor. after start all my workers i try make a call to one by pid and is generated one error (always).
At the beginning of the child I keep the pid with ets. Then when I want to make a call to this child I get the pid from the ets by an identifier. So far so good.
The problem is when I do the following:



GenServer.call(
pid,
{:action_project, %{project_id: project_id, pid: :erlang.pid_to_list(pid)}}
)


returns following error:



[error] GenServer #PID<0.606.0> terminating
** (RuntimeError) attempted to call GenServer #PID<0.606.0> but no handle_call/3 clause was provided
(backercamp) lib/gen_server.ex:693: MyApplication.ProjectWorker.handle_call/3
(stdlib) gen_server.erl:661: :gen_server.try_handle_call/4
(stdlib) gen_server.erl:690: :gen_server.handle_msg/6
(stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.680.0>): {:action_project, %{pid: '<0.606.0>', project_id: "23"}}
State: %{pid: '<0.606.0>', project_id: "23"}
Client #PID<0.680.0> is alive

(stdlib) gen.erl:169: :gen.do_call/4
(elixir) lib/gen_server.ex:921: GenServer.call/3


What's the problem with this call?



DynamicSupervisor code:



defmodule MyApplication.Supervisor do
use DynamicSupervisor

alias MyApplication.Management

def start_link(arg) do
DynamicSupervisor.start_link(__MODULE__, arg, name: __MODULE__)
end

def init(arg) do
DynamicSupervisor.init(arg)
end

def start_project_worker(project_id) do
spec = {MyApplication.ProjectWorker, %{project_id: project_id}}
DynamicSupervisor.start_child(__MODULE__, spec)
end

def start_all_project_workers() do
Enum.each(Management.list_all_projects(), fn %{id: project_id} ->
IO.puts("Started for project Id [#{project_id}]")
# 1s between workers
:timer.sleep(1000)
start_project_worker("#{project_id}")
end)
end

def action_project(pid, project_id) do
GenServer.call(
pid,
{:action_project, %{project_id: project_id, pid: :erlang.pid_to_list(pid)}}
)
end
end


Worker code:



defmodule MyApplication.ProjectWorker do

use GenServer, restart: :transient

alias MyApplication.Settings
alias MyApplication.Management

def start_link(state) do
GenServer.start_link(__MODULE__, state)
end

def init(state) do
schedule_action_project(Settings.get_frequency_ms())
state = Map.put(state, :pid, :erlang.pid_to_list(self()))
persist_state(state)
{:ok, state}
end

def handle_info(:schedule_action_project, %{project_id: _project_id, pid: _pid} = state) do
action_by_state(state)
{:noreply, state}
end

def handle_call({:action_project}, %{project_id: _project_id, pid: _pid} = state) do
case action_by_state(state) do
true ->
terminate(state)

false ->
{:reply, state, state}
end
end

defp persist_state(state) do
IO.puts(" :: Add project_id [#{state.project_id}] and pid #{state.pid}")
:ets.insert_new(:project_backup, {state.project_id, state.pid})
end

defp delete_persist_state(project_id) do
IO.puts(" :: Delete project_id [#{project_id}]")
:ets.delete(:project_backup, project_id)
end

defp schedule_action_project(time) do
IO.puts(" :: Schedule_action_project [#{time}]")
Process.send_after(self(), :schedule_action_project, time)
end

defp terminate(%{project_id: project_id, pid: _pid} = state) do
IO.puts(
" :: Stop processed, everything is done! project_id [#{state.project_id}] and pid #{
state.pid
}"
)

delete_persist_state(project_id)
{:stop, :normal, state}
end

defp action_by_state(%{project_id: _project_id, pid: _pid} = state) do
action_by_project(Management.get_project!(state.project_id))
end

defp action_by_project(%Project{} = project) do
#do something in project
end
end









share|improve this question

























  • What error do you get? Post the stack trace here.

    – Aleksei Matiushkin
    Nov 23 '18 at 11:08














1












1








1


2






I have a problem with communication with the workers created in my dynamicSupervisor. after start all my workers i try make a call to one by pid and is generated one error (always).
At the beginning of the child I keep the pid with ets. Then when I want to make a call to this child I get the pid from the ets by an identifier. So far so good.
The problem is when I do the following:



GenServer.call(
pid,
{:action_project, %{project_id: project_id, pid: :erlang.pid_to_list(pid)}}
)


returns following error:



[error] GenServer #PID<0.606.0> terminating
** (RuntimeError) attempted to call GenServer #PID<0.606.0> but no handle_call/3 clause was provided
(backercamp) lib/gen_server.ex:693: MyApplication.ProjectWorker.handle_call/3
(stdlib) gen_server.erl:661: :gen_server.try_handle_call/4
(stdlib) gen_server.erl:690: :gen_server.handle_msg/6
(stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.680.0>): {:action_project, %{pid: '<0.606.0>', project_id: "23"}}
State: %{pid: '<0.606.0>', project_id: "23"}
Client #PID<0.680.0> is alive

(stdlib) gen.erl:169: :gen.do_call/4
(elixir) lib/gen_server.ex:921: GenServer.call/3


What's the problem with this call?



DynamicSupervisor code:



defmodule MyApplication.Supervisor do
use DynamicSupervisor

alias MyApplication.Management

def start_link(arg) do
DynamicSupervisor.start_link(__MODULE__, arg, name: __MODULE__)
end

def init(arg) do
DynamicSupervisor.init(arg)
end

def start_project_worker(project_id) do
spec = {MyApplication.ProjectWorker, %{project_id: project_id}}
DynamicSupervisor.start_child(__MODULE__, spec)
end

def start_all_project_workers() do
Enum.each(Management.list_all_projects(), fn %{id: project_id} ->
IO.puts("Started for project Id [#{project_id}]")
# 1s between workers
:timer.sleep(1000)
start_project_worker("#{project_id}")
end)
end

def action_project(pid, project_id) do
GenServer.call(
pid,
{:action_project, %{project_id: project_id, pid: :erlang.pid_to_list(pid)}}
)
end
end


Worker code:



defmodule MyApplication.ProjectWorker do

use GenServer, restart: :transient

alias MyApplication.Settings
alias MyApplication.Management

def start_link(state) do
GenServer.start_link(__MODULE__, state)
end

def init(state) do
schedule_action_project(Settings.get_frequency_ms())
state = Map.put(state, :pid, :erlang.pid_to_list(self()))
persist_state(state)
{:ok, state}
end

def handle_info(:schedule_action_project, %{project_id: _project_id, pid: _pid} = state) do
action_by_state(state)
{:noreply, state}
end

def handle_call({:action_project}, %{project_id: _project_id, pid: _pid} = state) do
case action_by_state(state) do
true ->
terminate(state)

false ->
{:reply, state, state}
end
end

defp persist_state(state) do
IO.puts(" :: Add project_id [#{state.project_id}] and pid #{state.pid}")
:ets.insert_new(:project_backup, {state.project_id, state.pid})
end

defp delete_persist_state(project_id) do
IO.puts(" :: Delete project_id [#{project_id}]")
:ets.delete(:project_backup, project_id)
end

defp schedule_action_project(time) do
IO.puts(" :: Schedule_action_project [#{time}]")
Process.send_after(self(), :schedule_action_project, time)
end

defp terminate(%{project_id: project_id, pid: _pid} = state) do
IO.puts(
" :: Stop processed, everything is done! project_id [#{state.project_id}] and pid #{
state.pid
}"
)

delete_persist_state(project_id)
{:stop, :normal, state}
end

defp action_by_state(%{project_id: _project_id, pid: _pid} = state) do
action_by_project(Management.get_project!(state.project_id))
end

defp action_by_project(%Project{} = project) do
#do something in project
end
end









share|improve this question
















I have a problem with communication with the workers created in my dynamicSupervisor. after start all my workers i try make a call to one by pid and is generated one error (always).
At the beginning of the child I keep the pid with ets. Then when I want to make a call to this child I get the pid from the ets by an identifier. So far so good.
The problem is when I do the following:



GenServer.call(
pid,
{:action_project, %{project_id: project_id, pid: :erlang.pid_to_list(pid)}}
)


returns following error:



[error] GenServer #PID<0.606.0> terminating
** (RuntimeError) attempted to call GenServer #PID<0.606.0> but no handle_call/3 clause was provided
(backercamp) lib/gen_server.ex:693: MyApplication.ProjectWorker.handle_call/3
(stdlib) gen_server.erl:661: :gen_server.try_handle_call/4
(stdlib) gen_server.erl:690: :gen_server.handle_msg/6
(stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.680.0>): {:action_project, %{pid: '<0.606.0>', project_id: "23"}}
State: %{pid: '<0.606.0>', project_id: "23"}
Client #PID<0.680.0> is alive

(stdlib) gen.erl:169: :gen.do_call/4
(elixir) lib/gen_server.ex:921: GenServer.call/3


What's the problem with this call?



DynamicSupervisor code:



defmodule MyApplication.Supervisor do
use DynamicSupervisor

alias MyApplication.Management

def start_link(arg) do
DynamicSupervisor.start_link(__MODULE__, arg, name: __MODULE__)
end

def init(arg) do
DynamicSupervisor.init(arg)
end

def start_project_worker(project_id) do
spec = {MyApplication.ProjectWorker, %{project_id: project_id}}
DynamicSupervisor.start_child(__MODULE__, spec)
end

def start_all_project_workers() do
Enum.each(Management.list_all_projects(), fn %{id: project_id} ->
IO.puts("Started for project Id [#{project_id}]")
# 1s between workers
:timer.sleep(1000)
start_project_worker("#{project_id}")
end)
end

def action_project(pid, project_id) do
GenServer.call(
pid,
{:action_project, %{project_id: project_id, pid: :erlang.pid_to_list(pid)}}
)
end
end


Worker code:



defmodule MyApplication.ProjectWorker do

use GenServer, restart: :transient

alias MyApplication.Settings
alias MyApplication.Management

def start_link(state) do
GenServer.start_link(__MODULE__, state)
end

def init(state) do
schedule_action_project(Settings.get_frequency_ms())
state = Map.put(state, :pid, :erlang.pid_to_list(self()))
persist_state(state)
{:ok, state}
end

def handle_info(:schedule_action_project, %{project_id: _project_id, pid: _pid} = state) do
action_by_state(state)
{:noreply, state}
end

def handle_call({:action_project}, %{project_id: _project_id, pid: _pid} = state) do
case action_by_state(state) do
true ->
terminate(state)

false ->
{:reply, state, state}
end
end

defp persist_state(state) do
IO.puts(" :: Add project_id [#{state.project_id}] and pid #{state.pid}")
:ets.insert_new(:project_backup, {state.project_id, state.pid})
end

defp delete_persist_state(project_id) do
IO.puts(" :: Delete project_id [#{project_id}]")
:ets.delete(:project_backup, project_id)
end

defp schedule_action_project(time) do
IO.puts(" :: Schedule_action_project [#{time}]")
Process.send_after(self(), :schedule_action_project, time)
end

defp terminate(%{project_id: project_id, pid: _pid} = state) do
IO.puts(
" :: Stop processed, everything is done! project_id [#{state.project_id}] and pid #{
state.pid
}"
)

delete_persist_state(project_id)
{:stop, :normal, state}
end

defp action_by_state(%{project_id: _project_id, pid: _pid} = state) do
action_by_project(Management.get_project!(state.project_id))
end

defp action_by_project(%Project{} = project) do
#do something in project
end
end






erlang elixir otp supervisor elixir-framework






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 11:14







Nuno_Coletiv

















asked Nov 23 '18 at 11:05









Nuno_ColetivNuno_Coletiv

117111




117111













  • What error do you get? Post the stack trace here.

    – Aleksei Matiushkin
    Nov 23 '18 at 11:08



















  • What error do you get? Post the stack trace here.

    – Aleksei Matiushkin
    Nov 23 '18 at 11:08

















What error do you get? Post the stack trace here.

– Aleksei Matiushkin
Nov 23 '18 at 11:08





What error do you get? Post the stack trace here.

– Aleksei Matiushkin
Nov 23 '18 at 11:08












1 Answer
1






active

oldest

votes


















1














The issue is within a handler. You messed all the arguments up. state is an internal state of GenServer, you do not pass it through, you receive it in the callback. The following signature will match if your state is a map having keys project_id and pid and you call it like GenServer.call(pid, {:action_project}).



def handle_call({:action_project}, %{project_id: _project_id, pid: _pid} = state)


You should change this handler to match your caller:



def handle_call(
{:action_project, %{project_id: _project_id, pid: _pid}},
_from,
state
)


Also note that handle_call callback receives three parameters (unlike handle_cast, the second one being the source of the message.





Sidenote: handle_info callback has the wrong signature as well.






share|improve this answer
























  • ohhh you is a machine :D you right in relation to handle_call ... And what is wrong in handle_info?

    – Nuno_Coletiv
    Nov 23 '18 at 11:29






  • 1





    The same, I guess. I am not sure what the state is though.

    – Aleksei Matiushkin
    Nov 23 '18 at 11:33











  • another doubt. Is it possible to know at the beginning of a child if it comes from a restart? or have different init functions of child?

    – Nuno_Coletiv
    Nov 23 '18 at 12:23











  • I am not sure I follow. If you need a different init, the simplest way would be to create another module.

    – Aleksei Matiushkin
    Nov 23 '18 at 12:26






  • 1





    Nope. As a workaround, you might put something like a flag to DETS on the very first start, check this flag from init and behave accordingly.

    – Aleksei Matiushkin
    Nov 23 '18 at 12:45












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53445520%2fdynamicsupervisor-problem-with-communication-with-the-workers%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














The issue is within a handler. You messed all the arguments up. state is an internal state of GenServer, you do not pass it through, you receive it in the callback. The following signature will match if your state is a map having keys project_id and pid and you call it like GenServer.call(pid, {:action_project}).



def handle_call({:action_project}, %{project_id: _project_id, pid: _pid} = state)


You should change this handler to match your caller:



def handle_call(
{:action_project, %{project_id: _project_id, pid: _pid}},
_from,
state
)


Also note that handle_call callback receives three parameters (unlike handle_cast, the second one being the source of the message.





Sidenote: handle_info callback has the wrong signature as well.






share|improve this answer
























  • ohhh you is a machine :D you right in relation to handle_call ... And what is wrong in handle_info?

    – Nuno_Coletiv
    Nov 23 '18 at 11:29






  • 1





    The same, I guess. I am not sure what the state is though.

    – Aleksei Matiushkin
    Nov 23 '18 at 11:33











  • another doubt. Is it possible to know at the beginning of a child if it comes from a restart? or have different init functions of child?

    – Nuno_Coletiv
    Nov 23 '18 at 12:23











  • I am not sure I follow. If you need a different init, the simplest way would be to create another module.

    – Aleksei Matiushkin
    Nov 23 '18 at 12:26






  • 1





    Nope. As a workaround, you might put something like a flag to DETS on the very first start, check this flag from init and behave accordingly.

    – Aleksei Matiushkin
    Nov 23 '18 at 12:45
















1














The issue is within a handler. You messed all the arguments up. state is an internal state of GenServer, you do not pass it through, you receive it in the callback. The following signature will match if your state is a map having keys project_id and pid and you call it like GenServer.call(pid, {:action_project}).



def handle_call({:action_project}, %{project_id: _project_id, pid: _pid} = state)


You should change this handler to match your caller:



def handle_call(
{:action_project, %{project_id: _project_id, pid: _pid}},
_from,
state
)


Also note that handle_call callback receives three parameters (unlike handle_cast, the second one being the source of the message.





Sidenote: handle_info callback has the wrong signature as well.






share|improve this answer
























  • ohhh you is a machine :D you right in relation to handle_call ... And what is wrong in handle_info?

    – Nuno_Coletiv
    Nov 23 '18 at 11:29






  • 1





    The same, I guess. I am not sure what the state is though.

    – Aleksei Matiushkin
    Nov 23 '18 at 11:33











  • another doubt. Is it possible to know at the beginning of a child if it comes from a restart? or have different init functions of child?

    – Nuno_Coletiv
    Nov 23 '18 at 12:23











  • I am not sure I follow. If you need a different init, the simplest way would be to create another module.

    – Aleksei Matiushkin
    Nov 23 '18 at 12:26






  • 1





    Nope. As a workaround, you might put something like a flag to DETS on the very first start, check this flag from init and behave accordingly.

    – Aleksei Matiushkin
    Nov 23 '18 at 12:45














1












1








1







The issue is within a handler. You messed all the arguments up. state is an internal state of GenServer, you do not pass it through, you receive it in the callback. The following signature will match if your state is a map having keys project_id and pid and you call it like GenServer.call(pid, {:action_project}).



def handle_call({:action_project}, %{project_id: _project_id, pid: _pid} = state)


You should change this handler to match your caller:



def handle_call(
{:action_project, %{project_id: _project_id, pid: _pid}},
_from,
state
)


Also note that handle_call callback receives three parameters (unlike handle_cast, the second one being the source of the message.





Sidenote: handle_info callback has the wrong signature as well.






share|improve this answer













The issue is within a handler. You messed all the arguments up. state is an internal state of GenServer, you do not pass it through, you receive it in the callback. The following signature will match if your state is a map having keys project_id and pid and you call it like GenServer.call(pid, {:action_project}).



def handle_call({:action_project}, %{project_id: _project_id, pid: _pid} = state)


You should change this handler to match your caller:



def handle_call(
{:action_project, %{project_id: _project_id, pid: _pid}},
_from,
state
)


Also note that handle_call callback receives three parameters (unlike handle_cast, the second one being the source of the message.





Sidenote: handle_info callback has the wrong signature as well.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 23 '18 at 11:12









Aleksei MatiushkinAleksei Matiushkin

84.5k95795




84.5k95795













  • ohhh you is a machine :D you right in relation to handle_call ... And what is wrong in handle_info?

    – Nuno_Coletiv
    Nov 23 '18 at 11:29






  • 1





    The same, I guess. I am not sure what the state is though.

    – Aleksei Matiushkin
    Nov 23 '18 at 11:33











  • another doubt. Is it possible to know at the beginning of a child if it comes from a restart? or have different init functions of child?

    – Nuno_Coletiv
    Nov 23 '18 at 12:23











  • I am not sure I follow. If you need a different init, the simplest way would be to create another module.

    – Aleksei Matiushkin
    Nov 23 '18 at 12:26






  • 1





    Nope. As a workaround, you might put something like a flag to DETS on the very first start, check this flag from init and behave accordingly.

    – Aleksei Matiushkin
    Nov 23 '18 at 12:45



















  • ohhh you is a machine :D you right in relation to handle_call ... And what is wrong in handle_info?

    – Nuno_Coletiv
    Nov 23 '18 at 11:29






  • 1





    The same, I guess. I am not sure what the state is though.

    – Aleksei Matiushkin
    Nov 23 '18 at 11:33











  • another doubt. Is it possible to know at the beginning of a child if it comes from a restart? or have different init functions of child?

    – Nuno_Coletiv
    Nov 23 '18 at 12:23











  • I am not sure I follow. If you need a different init, the simplest way would be to create another module.

    – Aleksei Matiushkin
    Nov 23 '18 at 12:26






  • 1





    Nope. As a workaround, you might put something like a flag to DETS on the very first start, check this flag from init and behave accordingly.

    – Aleksei Matiushkin
    Nov 23 '18 at 12:45

















ohhh you is a machine :D you right in relation to handle_call ... And what is wrong in handle_info?

– Nuno_Coletiv
Nov 23 '18 at 11:29





ohhh you is a machine :D you right in relation to handle_call ... And what is wrong in handle_info?

– Nuno_Coletiv
Nov 23 '18 at 11:29




1




1





The same, I guess. I am not sure what the state is though.

– Aleksei Matiushkin
Nov 23 '18 at 11:33





The same, I guess. I am not sure what the state is though.

– Aleksei Matiushkin
Nov 23 '18 at 11:33













another doubt. Is it possible to know at the beginning of a child if it comes from a restart? or have different init functions of child?

– Nuno_Coletiv
Nov 23 '18 at 12:23





another doubt. Is it possible to know at the beginning of a child if it comes from a restart? or have different init functions of child?

– Nuno_Coletiv
Nov 23 '18 at 12:23













I am not sure I follow. If you need a different init, the simplest way would be to create another module.

– Aleksei Matiushkin
Nov 23 '18 at 12:26





I am not sure I follow. If you need a different init, the simplest way would be to create another module.

– Aleksei Matiushkin
Nov 23 '18 at 12:26




1




1





Nope. As a workaround, you might put something like a flag to DETS on the very first start, check this flag from init and behave accordingly.

– Aleksei Matiushkin
Nov 23 '18 at 12:45





Nope. As a workaround, you might put something like a flag to DETS on the very first start, check this flag from init and behave accordingly.

– Aleksei Matiushkin
Nov 23 '18 at 12:45




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53445520%2fdynamicsupervisor-problem-with-communication-with-the-workers%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Xamarin.form Move up view when keyboard appear

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Anylogic : not able to use stopDelay()