I can't stop my elixir app! (60+ seconds to quit!)

I’ve built a moderate sized app and now started to test it deployed. One of the challenges is that the deployed box is a little arm box and relatively slow. I’ve now discovered that shutting it down by sending it an external kill -SIGTERM signal takes around 60+ seconds (which in itself might indicate some other time out which is too long?)

I can repro this by starting the release, connecting with
./bin/app remote
Then from the console running:
:init.stop()

After about 20 seconds the console dies, then if I watch top, there is another 30+ seconds of CPU maxing out before the process disappears

OK, so almost certainly this is something I have done wrong, perhaps a genserver restarting when it’s been told to shutdown, etc? How do I find or log this though to figure out what went wrong? Is there some way to instrument the stop process?

The machines I can run this on are all headless without any wx installed. I can run up observer on my laptop, but that seems to get kicked out within a few seconds of the init starting.

Bit stumped on how to track this down? Any suggestions?