DynamicSupervisor.terminate_child shuts down entire Phoenix application

Hi there,

I have a phoenix application which has a Dynamic supervisor in its supervision tree. When I add any trivial GenServer to the DynamicSupervisor, then call DynamicSupervisor.terminate_child on that trivial GenServer, it shuts down the entire phoenix application.

I made a small repo to reproduce the issue: https://github.com/ericdude4/dynamic_supervisor_demo

The README includes some instructions on how to reproduce the issue. Its a totally bare phoenix app except I made a change in application.ex and added the trivial server.ex

My question is, how can I terminate that child without crashing the entire application?

Thank you,

DynamicSupervisorDemo.Application.start/2 returns the genserver as the applications root process instead of the supervision tree. If you shutdown the root process of an application the application is stopped.

1 Like

Thank you so much! Here is the commit which fixes the broken repo: https://github.com/ericdude4/dynamic_supervisor_demo/commit/bbf28459f469efafc02dbad2fe5522c45e43b1c0

You have helped me so many times. I really appreciate all you do for this community

1 Like