>> On Mon, May 11, 2015 at 9:13 PM, Roberto Ostinelli <
>> > wrote:
>> >/ In non-erlang systems, I would have standard watchdogs that
>> launch an
>> />/ application on OS boot, and then monitor it and relaunch it if
>> The heart system in Erlang is a simple watchdog, mostly used if you
>> else that will restart your application. In an SysV init system,
>> there is
>> no automatic watching and restart. In RcNG in FreeBSD, there is no
>> In OpenBSDs rc, there is no automatic restart.
> Wait a minute - isn't that what respawn does in a SysV init environment?
> Of course that only works if the VM well and truly dies. If it locks
> up, you still have a problem.
> Anybody see a reason you couldn't:
> 1. start BEAM with respawn
> 2. start a separate watchdog process that periodically runs a few
> tests to see if BEAM is running properly,
> and if not, KILLs the process - at which point respawn would take care
> of a restart.
> Miles Fidelman
On 2015年5月12日 火曜日 19:59:55 Michael L Martin wrote:
> But who watches the watchdog?
Depends on which type you're talking about.
Some (most?) watchdog/procdoc type systems start two processes that watch each other in addition to the target process(es).
When writing these for my own daemons I usually make an "undead mode" where a monitor daemon is created to watch the service daemon, and the service daemon itself acts as the monitor for the monitor daemon.
Even later reply. To chime in on Danills comment. It is a linux specific problem that the kernel OOM killer will go ahead and kill the whole process tree meaning Erlang and Heart at the same time because heart is a child process of erl.
For this reason I would strongly advise against using heart on linux based systems at this time. One option is using supervisord which is very easy to configure and use with erlang - and does not have the above problem.
Here is a complete sample configuration with '...' as placeholders for your deployment: