为什么 Erlang riak 客户端会崩溃?

Why is the Erlang riak client crashing?

我已经关注了riak installation instructions for Ubuntu and the readme for the riak erlang client。在发送 ping 以测试连接的客户端说明中,我收到以下错误报告,指示缺少模块。在报告中,我将我的服务器 IP 替换为 IP_Of_Server。

如何确保模块包含在客户端的编译中?它应该位于哪里?

riakc_pb_socket:ping(Pid).
=ERROR REPORT==== 28-Apr-2022::20:04:49.468604 ===
** Generic server <0.81.0> terminating 
** Last message in was {req,rpbpingreq,60000}
** When Server state == {state,"IP_Of_Server",8087,false,false,#Port<0.7>,
                               false,gen_tcp,undefined,
                               {[],[]},
                               1,[],infinity,undefined,undefined,undefined,
                               undefined,[],100,false,
                               {false,0}}
** Reason for termination ==
** {'module could not be loaded',
       [{riak_pb_codec,encode,[rpbpingreq],[]},
        {riakc_pb_socket,encode_request_message,1,
            [{file,"/home/pseudo/riak-erlang-client/src/riakc_pb_socket.erl"},
             {line,3297}]},
        {riakc_pb_socket,send_request,2,
            [{file,"/home/pseudo/riak-erlang-client/src/riakc_pb_socket.erl"},
             {line,3269}]}, 
        {riakc_pb_socket,handle_call,3,
            [{file,"/home/pseudo/riak-erlang-client/src/riakc_pb_socket.erl"},
             {line,2089}]},
        {gen_server,try_handle_call,4,[{file,"gen_server.erl"},{line,661}]},
        {gen_server,handle_msg,6,[{file,"gen_server.erl"},{line,690}]},
        {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}
** Client <0.78.0> stacktrace
** [{gen,do_call,4,[{file,"gen.erl"},{line,167}]},
    {gen_server,call,3,[{file,"gen_server.erl"},{line,219}]},
    {erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,684}]},
    {shell,exprs,7,[{file,"shell.erl"},{line,686}]},
    {shell,eval_exprs,7,[{file,"shell.erl"},{line,642}]},
    {shell,eval_loop,3,[{file,"shell.erl"},{line,627}]}]

=CRASH REPORT==== 28-Apr-2022::20:04:49.469247 ===
  crasher:
    initial call: riakc_pb_socket:init/1
    pid: <0.81.0>
    registered_name: []
    exception error: undefined function riak_pb_codec:encode/1
      in function  riakc_pb_socket:encode_request_message/1 (/home/pseudo/riak-erlang-client/src/riakc_pb_socket.erl, line 3297)
      in call from riakc_pb_socket:send_request/2 (/home/pseudo/riak-erlang-client/src/riakc_pb_socket.erl, line 3269)
      in call from riakc_pb_socket:handle_call/3 (/home/pseudo/riak-erlang-client/src/riakc_pb_socket.erl, line 2089)
      in call from gen_server:try_handle_call/4 (gen_server.erl, line 661)
      in call from gen_server:handle_msg/6 (gen_server.erl, line 690)
    ancestors: [<0.78.0>]
    message_queue_len: 0
    messages: []
    links: [<0.78.0>,#Port<0.7>]
    dictionary: []
    trap_exit: false
    status: running
    heap_size: 6772
    stack_size: 27
    reductions: 13740
  neighbours:
    neighbour:
      pid: <0.78.0>
      registered_name: []
      initial_call: {erlang,apply,2}
      current_function: {gen,do_call,4}
      ancestors: []
      message_queue_len: 0
      links: [<0.77.0>,<0.81.0>]
      trap_exit: false
      status: waiting
      heap_size: 610
      stack_size: 34
      reductions: 4167
      current_stacktrace: [{gen,do_call,4,[{file,"gen.erl"},{line,167}]},
                  {gen_server,call,3,[{file,"gen_server.erl"},{line,219}]},
                  {erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,684}]},
                  {shell,exprs,7,[{file,"shell.erl"},{line,686}]},
                  {shell,eval_exprs,7,[{file,"shell.erl"},{line,642}]},
                  {shell,eval_loop,3,[{file,"shell.erl"},{line,627}]}]
** exception exit: undef
     in function  riak_pb_codec:encode/1
        called as riak_pb_codec:encode(rpbpingreq)
     in call from riakc_pb_socket:encode_request_message/1 (/home/pseudo/riak-erlang-client/src/riakc_pb_socket.erl, line 3297)
     in call from riakc_pb_socket:send_request/2 (/home/pseudo/riak-erlang-client/src/riakc_pb_socket.erl, line 3269)
     in call from riakc_pb_socket:handle_call/3 (/home/pseudo/riak-erlang-client/src/riakc_pb_socket.erl, line 2089)
     in call from gen_server:try_handle_call/4 (gen_server.erl, line 661)
     in call from gen_server:handle_msg/6 (gen_server.erl, line 690)
     in call from proc_lib:init_p_do_apply/3 (proc_lib.erl, line 249)

这是我的发现。

启动REPL时,行

erl -pa ./riak-erlang-client/_build/default/lib/riakc/ebin ./riak-erlang-client/_build/default/lib/riakc/deps/*/ebin

缺少目录声明。我把它改成了

erl -pa ./riak-erlang-client/_build/default/lib/riakc/ebin ./riak-erlang-client/_build/default/lib/riakc/deps/*/ebin ./riak-erlang-client/_build/default/lib/riak_pb/ebin/