[erlang-questions] using a registered name with lib_chan fails

Edmund Sumbar esumbar@REDACTED
Thu May 16 06:05:20 CEST 2013


Hi (from an erlang newbie),

I can get the name server example at the end of chapter 14 of
Programming Erlang 2nd ed to work perfectly with just the kvs,
mod_name_server, and lib_chan* modules compiled in their own
directory. The code from the book is in a completely different
directory. My search path is the default.

When I register the Pid from the lib_chan:connect function and
subsequently pass the registered name to the lib_chan:rpc function,
the client process hangs. Using the registered name with lib_chan:cast
works. This is what I get...

<<< server >>>
$ erl
Erlang R16B (erts-5.10.1) [source] [64-bit] [smp:8:8]
[async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Processing $HOME/.erlang... done
Eshell V5.10.1  (abort with ^G)
1> kvs:start().
true
2> lib_chan:start_server().
lib_chan starting:"/Users/esumbar/.erlang_config/lib_chan.conf"
ConfigData=[{port,1234},
            {service,nameServer,password,"ABXy45",mfa,mod_name_server,
                     start_me_up,notUsed}]
true

<<< client >>>
$ erl
Erlang R16B (erts-5.10.1) [source] [64-bit] [smp:8:8]
[async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Processing $HOME/.erlang... done
Eshell V5.10.1  (abort with ^G)
1> {ok, Pid} = lib_chan:connect("localhost", 1234, nameServer, "ABXy45", "").
{ok,<0.34.0>}
2> register(abc, Pid).
true
3> lib_chan:cast(abc, {store, joe, "writing a book"}).
{send,{store,joe,"writing a book"}}
4> lib_chan:rpc(Pid, {lookup, joe}).
{ok,"writing a book"}
5> lib_chan:rpc(abc, {lookup, joe}).
<<< no response >>>

I looked at the lib_chan:rpc implementation. It's pretty
straightforward. I suppose it’s hanging because there’s no matching
receive pattern, but I can’t figure out why that would be.

Any help would be appreciated.

Ed



More information about the erlang-questions mailing list