[erlang-questions] "detached VM" vs "VM under screen"

Tim Watson watson.timothy@REDACTED
Sat Jan 7 19:32:33 CET 2012


Doesn't seem to play nicely on OSX:

t4@REDACTED:custom-assembly $ ps -ef | grep run_erl
  501  1349  2378   0   0:00.00 ttys001    0:00.00 grep run_erl
t4@REDACTED:custom-assembly $ HEART_COMMAND="run_erl -daemon /tmp/test/
/tmp/test/ 'erl -heart'" run_erl -daemon /tmp/test/ /tmp/test/ "erl -heart"
t4@REDACTED:custom-assembly $ ps -ef | grep run_erl
  501  1352     1   0   0:00.00 ??         0:00.00 run_erl -daemon
/tmp/test/ /tmp/test/ erl -heart
  501  1359  2378   0   0:00.00 ttys001    0:00.00 grep run_erl
t4@REDACTED:custom-assembly $ ps -ef | grep beam
  501  1353  1352   0   0:00.07 ttys000    0:00.19
/Users/t4/Library/Erlang/Versions/R15B64-LHSE/erts-5.9/bin/beam.smp --
-root /Users/t4/Library/Erlang/Versions/R15B64-LHSE -progname erl -- -home
/Users/t4 -- -heart
  501  1361  2378   0   0:00.00 ttys001    0:00.00 grep beam
t4@REDACTED:custom-assembly $ echo "1 + 1." | to_erl /tmp/test/
Attaching to /tmp/test/erlang.pipe.1 (^D to exit)

[EOF]
t4@REDACTED:custom-assembly $  tail -n3 /tmp/test/erlang.log.1
1> 1 + 1.
2
2> t4@REDACTED:custom-assembly $
t4@REDACTED:custom-assembly $
t4@REDACTED:custom-assembly $
t4@REDACTED:custom-assembly $ ps -ef | grep run_erl
  501  1352     1   0   0:00.00 ??         0:00.00 run_erl -daemon
/tmp/test/ /tmp/test/ erl -heart
  501  1366  2378   0   0:00.00 ttys001    0:00.00 grep run_erl
t4@REDACTED:custom-assembly $ kill -9 1352
t4@REDACTED:custom-assembly $ ps -ef | grep run_erl
  501  1368  2378   0   0:00.00 ttys001    0:00.00 grep run_erl
t4@REDACTED:custom-assembly $ ps -ef | grep beam
  501  1353     1   0   0:03.73 ttys000    0:09.12
/Users/t4/Library/Erlang/Versions/R15B64-LHSE/erts-5.9/bin/beam.smp --
-root /Users/t4/Library/Erlang/Versions/R15B64-LHSE -progname erl -- -home
/Users/t4 -- -heart
  501  1370  2378   0   0:00.00 ttys001    0:00.00 grep beam
t4@REDACTED:custom-assembly $ evm info
R15B compiled for i386-apple-darwin10.8.0, 64bit
t4@REDACTED:custom-assembly $ echo "2 + 2." | to_erl /tmp/test/
No running Erlang on pipe /tmp/test/erlang.pipe.1: Device not configured
t4@REDACTED:custom-assembly $

On 7 January 2012 15:42, Garrett Smith <g@REDACTED> wrote:

> On Sat, Jan 7, 2012 at 9:34 AM, Zabrane Mickael <zabrane3@REDACTED>
> wrote:
> >
> > On Jan 7, 2012, at 4:04 PM, Garrett Smith wrote:
> >
> >> On Fri, Jan 6, 2012 at 5:15 PM, Zabrane Mickael <zabrane3@REDACTED>
> wrote:
> >>> Hi Garrett,
> >>>
> >>> I've tried to reproduce you example by copy and past
> >>> on both Linux/OSX R14B04 and OSX R15B:
> >>>
> >>> Each time I kill one of these process:
> >>> - beam
> >>> - run_erl
> >>> - heart
> >>>
> >>> the two others die too.
> >>
> >> Killing beam or run_erl should result in the corresponding process
> >> dying as well. But if run with -heart and with a correct
> >> HEART_COMMAND, run_erl/beam be restarted.
> >>
> >> Killing heart has the effect of killing its child processes.
> >
> > I tried several time (copy/past your example). Same result.
> > I'll try again on virtual machine with a fresh Erlang installed.
> > Which Linux are you using Garrett?
>
> I'm not clear on what the problem is. See next point.
>
> > Can someone else please confirm Garret's example on his machine?
> >
> >>
> >>> I can't explain why.
> >>>
> >>> By the way, the test
> >>> echo "1 + 1." | to_erl /tmp/test/
> >>> works perfectly
> >>
> >> In your tests, did the "2 + 2" and "4 + 4" examples work?
> >
> > Yep, they both work correctly.
>
> I suspect you're seeing the correct behavior then. The point of the
> example is to show that, by using -heart, your Erlang process, running
> under run_erl, will be restarted whether it's the beam process or the
> run_erl process that's killed.
>
> The fact that the "2 + 2" and "4 + 4" scenarios are working mean that
> your Erlang process is indeed getting restarted.
>
> Garrett
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120107/61fbf261/attachment.htm>


More information about the erlang-questions mailing list