erl_call

Gerd Flaig gerd@REDACTED
Mon Apr 9 16:19:29 CEST 2001


Hi,

I noticed some strange behaviour with erl_call (erl_interface versions
3.2 and 3.2.9). When there is more than one instance of erl_call
running concurrently against the same erlang node, there is a rather
high possibility that one of them terminates with an error.

   -module(test).
   -export([start/0,count/0,count/1,incr/0]).
   
   start() ->
       Pid = spawn_link(test, count, []),
       true = register(counter, Pid).
       
   count() ->
       count(0).
   
   count(N) ->
       receive
           {incr, Pid} ->
               Pid ! {count, N+1},
               test:count(N+1);
           Other ->
               io:format('unknown: ~w~n', [Other])
       end,
       test:count(N).
   
   incr() ->
       counter ! {incr, self()},
       receive
           {count, N} ->
               N;
           Other ->
               io:format('unknown: ~w~n', [Other])
       end.

im% erl -name test
Erlang (BEAM) emulator version 5.0.2 [source]

Eshell V5.0.2  (abort with ^G)
(test@REDACTED)1> c(test).
{ok,test}
(test@REDACTED)2> test:start().
true

   im% cat test.pl
   #! /usr/bin/perl -w
   
   $erlcall = 'echo \'test:incr().\' | /usr/lib/erlang/lib/erl_interface-3.2.9/bin/erl_call -e -n test@REDACTED';
   
   $last = 0;
   for(;;) {
     ($n) = `$erlcall` =~ m/{ok,(\d+)}/;
     if($n - $last != 1) {
       print "n: $n, last: $last\n";
     }
     $last = $n;
   }

When I run test.pl, I get lots of these:

   <ERROR> erl_connect failed

Any ideas?

        Goodbyte, Gerd.
-- 
Gerd Flaig                     Technik                gerd@REDACTED
Bei Schlund + Partner AG       Erbprinzenstr. 4-12  D-76133 Karlsruhe



More information about the erlang-questions mailing list