<div dir="ltr">Hi,<br><br>I was made some experiments with heart<br>and I found something surpizing, athough it<br>does the job.<br><br>I start a erlang vm in daemon mode under user called<br>_user0 with home in /var/app like this<br>(from a shell script /var/app/appd run with sudo as a priv user):<br><br>case $1 in<br>  start)<br><br>su - _user0 -c "$ERL -boot start_sasl -config $LOG +K true +A 4 -sname $NODE  -heart -detached -s app_ctl start $NODE"<br><br>;;<br> <br>  restart)<br>     /usr/local/lib/erlang/lib/erl_interface-3.7.20/bin/erl_call -q -sname $NODE<br>     sleep 2<br>     $ERL -boot start_sasl -config $LOG +K true +A 4 -sname $NODE\<br>                                 -heart -detached -s app_ctl start $NODE<br>    ;;<br><br>....<br><br>exit 0<br><br>environment vars are(under user _user0):<br><br>HEART_COMMAND=/bin/sh /var/app/appd restart<br>ERL_CRASH_DUMP_SECONDS=10<br><br>I have noticed 3 problems:<br>1)  Starting the daemon (as a priv user) with sudo sh /var/app/appd start<br>     it starts the heart subsystem, but when I issue sudo kill -9 <pid-of_erlang-<br>    vm-monitored-byheart>, the erlang vm is killed but heart never restarts it;<br>    Running as _user0 the command /bin/sh /var/app/appd restart manually<br>    heart restarts the system monitored after was killed;<br><br>2) Everytime I kill a vm monitored by heart with kill -9 <pid-of-vm> the heart procces restarts it immediately, and after that the heart process dies itself,and if in restart is not mentioned -heart option, the heart process is not restarted for the newly restarted erlang vm.<br><br>3) It seems the default timeout of 60 seconds is not respected because<br>the vm is restarted immediately -heart option is specified in restart script;<br><br>So a heart process is tied up to an erlang vm that it monitors and it dies after it spawns another erlang vm?<br><br>The docs are not clear about these.<br><br>Having said these what are the best practices to use heart and why<br>heart behaves like above?<br><br>It seems heart works with kill -KILL|SIGV <pid-of-vm>, but I  am not sure<br>what happens if the erlang vm crashes when runs out of memory of file descriptors.<br>Is the vm restarted by heart in these conditions?<br><br>System: OTP 17.5 64 bits<br><br>Thanks,<br>Bogdan<br><br><br></div>