Open nerdyworm opened 5 months ago
Update: I discovered that using erlang:exit(Pid, normal)
from an external process does not stop the process.
I've updated my PR to use erlang:exit(Pid, shutdown)
. This successfully stops the actors and everything looks perfect.
I've also discovered if your actor traps exits, then you'll have to match on the following in your actor to shut it down, otherwise, it will timeout -> brutal kill.
Down(ExitMessage(_supervisor_pid, Abnormal("Shutdown"))) -> {
actor.Stop(Abnormal("shutdown"))
}
The original issue that I was facing was that supervisors never actually killed their child processes, thus leading to a memory/process leak when my system was running for about a week.
This pull request implements the two strategies that erlang's supervisor employees, timeout and brutal kill.
The root cause of why actors never exit with erlang:exit(pid, normal) is still unknown.