[erlang-questions] Heart behavior
Mon Jul 6 10:48:19 CEST 2015
I was made some experiments with heart
and I found something surpizing, athough it
does the job.
I start a erlang vm in daemon mode under user called
_user0 with home in /var/app like this
(from a shell script /var/app/appd run with sudo as a priv user):
case $1 in
su - _user0 -c "$ERL -boot start_sasl -config $LOG +K true +A 4 -sname
$NODE -heart -detached -s app_ctl start $NODE"
/usr/local/lib/erlang/lib/erl_interface-3.7.20/bin/erl_call -q -sname
$ERL -boot start_sasl -config $LOG +K true +A 4 -sname $NODE\
-heart -detached -s app_ctl start $NODE
environment vars are(under user _user0):
HEART_COMMAND=/bin/sh /var/app/appd restart
I have noticed 3 problems:
1) Starting the daemon (as a priv user) with sudo sh /var/app/appd start
it starts the heart subsystem, but when I issue sudo kill -9
vm-monitored-byheart>, the erlang vm is killed but heart never restarts
Running as _user0 the command /bin/sh /var/app/appd restart manually
heart restarts the system monitored after was killed;
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.
3) It seems the default timeout of 60 seconds is not respected because
the vm is restarted immediately -heart option is specified in restart
So a heart process is tied up to an erlang vm that it monitors and it dies
after it spawns another erlang vm?
The docs are not clear about these.
Having said these what are the best practices to use heart and why
heart behaves like above?
It seems heart works with kill -KILL|SIGV <pid-of-vm>, but I am not sure
what happens if the erlang vm crashes when runs out of memory of file
Is the vm restarted by heart in these conditions?
System: OTP 17.5 64 bits
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions