riak

Why is the Erlang riak client crashing?


I have followed the riak installation instructions for Ubuntu and the readme for the riak erlang client. At the point in the client instructions where a ping is sent to test the connection, I get the error report below indicating a missing module. In the report, I've replace my server IP with IP_Of_Server.

How do I make sure the module is included in the compile of the client? Where should it be located?

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)

Solution

  • Here is what I have found.

    When starting the REPL, the line

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

    was missing a directory declaration. I changed it to be

    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/