Crash supervisor after killing Broadway process
DmitryKK opened this issue · 1 comments
DmitryKK commented
Hi, I have application supervisor which starts broadway process:
opts = [strategy: :one_for_one, name: __MODULE__]
Supervisor.start_link([MessagesConsumer], opts)
and my process:
use Broadway
def start_link(_) do
Broadway.start_link(__MODULE__,
name: __MODULE__,
producer: [
module:
{BroadwayRabbitMQ.Producer,
queue: @queue,
declare: QueueDeclareOptions.get(@queue),
connection: connection(),
on_failure: :reject_and_requeue,
qos: [prefetch_count: 10],
buffer_size: 10_000}
],
processors: [default: [concurrency: 10]]
)
end
When I kill my process via Process.exit(:kill)
then my supervisor crashes totally:
09:37:44.222 [error] CRASH REPORT Process <0.664.0> with 0 neighbours crashed with reason: no match of right hand value {error,{already_started,<0.624.0>}} in 'Elixir.Broadway.Topology':init/1 line 37
...
09:37:44.246 [info] Application scenarios exited with reason: shutdown
As I got it, the linked process was not killed. How to solve this problem?
mix.exs:
{:broadway_rabbitmq, "~> 0.6.5"},
josevalim commented
The linked process will eventually terminate. Since it is trapping exits, it will trigger the clean up and once the clean up is done it terminates. Please use Broadway.stop for a clean shutdown instead of outright killing it.