Hello,
Today I noticed strange process behavior in the staging logs and it turned out that one of the supervised processes is being restarted during node shutdown (upon deployment).
The process name is Account
and it is supervised by AccountSupervisor
. Simplified definition will look like this:
defmodule Postman.Processor.AccountSupervisor do
def init([account_name, max_demand]) do
supervise(
[
worker(Postman.Processor.Stage.Account, [account_name, max_demand]),
],
strategy: :one_for_one
)
end
end
I added a couple of IO.inspect
and here is what I got
17:37:35.457 [info] Running App.Endpoint with Cowboy using http://localhost:4000
AccountSupervisor/start_link, #PID<0.1989.0>: "starting list1"
AccountSupervisor/init, #PID<0.1992.0>: "starting list1"
Account/start_link, #PID<0.1992.0>: "starting list1"
Account/init, #PID<0.1993.0>: "starting list1"
^C
Shutting down..
Account/start_link, #PID<0.1992.0>: "starting list1"
Account/init, #PID<0.2005.0>: "starting list1"
=SUPERVISOR REPORT==== 9-Mar-2017::17:38:51 ===
Supervisor: {via,'Elixir.Registry',
{'Elixir.Postman.Registry',<<"list1-supervisor">>}}
Context: child_terminated
Reason: shutdown
Offender: [{pid,<0.1993.0>},
{id,'Elixir.Postman.Processor.Stage.Account'},
{mfargs,
{'Elixir.Postman.Processor.Stage.Account',start_link,
[<<"list1">>,3]}},
{restart_type,permanent},
{shutdown,5000},
{child_type,worker}]
=CRASH REPORT==== 9-Mar-2017::17:38:51 ===
crasher:
initial call: Elixir.GenStage:init/1
pid: <0.2005.0>
registered_name: []
exception exit: noproc
in function gen_server:init_it/6 (gen_server.erl, line 344)
ancestors: [<0.1992.0>,'Elixir.Postman.Processor.AccountsSupervisor',
'Elixir.Postman.Supervisor',<0.1983.0>]
messages: []
links: [<0.1992.0>]
dictionary: []
trap_exit: false
status: running
heap_size: 376
stack_size: 27
reductions: 296
neighbours:
=SUPERVISOR REPORT==== 9-Mar-2017::17:38:51 ===
Supervisor: {via,'Elixir.Registry',
{'Elixir.Postman.Registry',<<"list1-supervisor">>}}
Context: start_error
Reason: noproc
Offender: [{pid,<0.1993.0>},
{id,'Elixir.Postman.Processor.Stage.Account'},
{mfargs,
{'Elixir.Postman.Processor.Stage.Account',start_link,
[<<"list1">>,3]}},
{restart_type,permanent},
{shutdown,5000},
{child_type,worker}]
ok
Can anyone please help to figure out what’s going on?