Search code examples
herokuerlangsignals

Handling signals in erl_child_setup


I have a problem with deploying Elixir/Phoenix application on Heroku. When Heroku restarts or stops the dyno, it sends SIGTERM to all user processes. Erlang starts 3 processes on application startup:

  • erl_child_setup
  • Erlang Port Mapper Deamon
  • Actual application

Sending SIGTERM to erl_child_setup results in crashing the VM and generating erl_crash.dump.

Sending SIGTERM to all processes is used quite often to ensure a graceful shutdown. While researching the crash cause I saw that people had similar issues with stopping docker containers running Erlang.

My question is: Is there a way to gracefully shutdown the VM when erl_child_setup gets SIGTERM or is there a way to instruct Heroku not to send SIGTERM to erl_child_setup?


Solution

  • This was fixed in OTP-23.1.4, according to the reported bug, and this PR.