0

When trying to run this command on Ejabberd 2.1.5-3 with Erlang R14A

ejabberdctl dump /tmp/ejabberd1.text

to dump the registered users from ejabberd I receive

{error_logger,{{2012,5,17},{17,9,48}},"Too short cookie string",[]} {error_logger,{{2012,5,17},{17,9,48}},crash_report,[[{initial_call,{auth,init,['Argument__1']}},{pid,<0.19.0>},{registered_name,[]},{error_info,{exit,{"Too short cookie string",[{auth,init_cookie,0},{auth,init,1},{gen_server,init_it,6},{proc_lib,init_p_do_apply,3}]},[{gen_server,init_it,6},{proc_lib,init_p_do_apply,3}]}},{ancestors,[net_sup,kernel_sup,<0.9.0>]},{messages,[]},{links,[<0.17.0>]},{dictionary,[]},{trap_exit,true},{status,running},{heap_size,987},{stack_size,24},{reductions,871}],[]]} {error_logger,{{2012,5,17},{17,9,48}},supervisor_report,[{supervisor,{local,net_sup}},{errorContext,start_error},{reason,{"Too short cookie string",[{auth,init_cookie,0},{auth,init,1},{gen_server,init_it,6},{proc_lib,init_p_do_apply,3}]}},{offender,[{pid,undefined},{name,auth},{mfargs,{auth,start_link,[]}},{restart_type,permanent},{shutdown,2000},{child_type,worker}]}]} {error_logger,{{2012,5,17},{17,9,48}},supervisor_report,[{supervisor,{local,kernel_sup}},{errorContext,start_error},{reason,shutdown},{offender,[{pid,undefined},{name,net_sup},{mfargs,{erl_distribution,start_link,[]}},{restart_type,permanent},{shutdown,infinity},{child_type,supervisor}]}]} {error_logger,{{2012,5,17},{17,9,48}},std_info,[{application,kernel},{exited,{shutdown,{kernel,start,[normal,[]]}}},{type,permanent}]} {"Kernel pid terminated",application_controller,"{application_start_failure,kernel,{shutdown,{kernel,start,[normal,[]]}}}"}

I tried removing the cookie file and restarting but this didn't help.

4

5 回答 5

0

Check that the cookie file has some content, you'll get this error if it is empty.

于 2012-05-18T20:14:32.657 回答
0

Please post your cookie file content here. May the cookie's length is really too short.

Or you can grep the source code of erlang for finding "too short cookie string" to check what's the problem.

2012/5/22, the following content added.

I have greped the my erlang source code (R15B) and found the string "Too short cookie string", only in the file "auth.erl". The related codes as follows. From the source code, your file's cookie file is empty, so the error will appear.

I think there are two way to check it.

  1. You can check this by using erlang:get_cookie() -> Cookie | nocookie in the erlang shell.
  2. You can modify the following read_cookie file by adding debugging expression for writing the detailed cookie's directory, and compile it into *.beam file and replace the old one.

Maybe Ejabberd has used another os's user and use another's home directory's erlang's cookie file and the other cookie file content is empty. I haven't used Ejabberd before, but have faced similar problem before in rabbitmq 2 months ago.

check_cookie([Letter|Rest], Result) when $\s =< Letter, Letter =< $~ ->
    check_cookie(Rest, [Letter|Result]);
check_cookie([X|Rest], Result) ->
    check_cookie1([X|Rest], Result);
check_cookie([], Result) ->
    check_cookie1([], Result).

check_cookie1([$\n|Rest], Result) ->
    check_cookie1(Rest, Result);
check_cookie1([$\r|Rest], Result) ->
    check_cookie1(Rest, Result);
check_cookie1([$\s|Rest], Result) ->
    check_cookie1(Rest, Result);
check_cookie1([_|_], _Result) ->
    {error, "Bad characters in cookie"};
check_cookie1([], []) ->
    {error, "Too short cookie string"};
check_cookie1([], Result) ->
    {ok, lists:reverse(Result)}.

read_cookie(Name, Size) ->
    case file:open(Name, [raw, read]) of
    {ok, File} ->
        case file:read(File, Size) of
        {ok, List} ->
            file:close(File),
            check_cookie(List, []);
        {error, Reason} ->
            make_error(Name, Reason)
        end;
    {error, Reason} ->
        make_error(Name, Reason)
    end.
于 2012-05-19T00:43:14.067 回答
0

The problem ended up being the version of Erlang and the version of Ejabberd were not compatible. Once I corrected the Erlang version the problem went away. Lesson here is to make sure you are running the recommended version of erlang for your ejabberd version.

于 2012-11-08T22:52:14.340 回答
0

For me the issue was that the file: /var/lib/rabbitmq/.erlang.cookie was with more than 1 line:

LOBGMGERILECQBFOFTLL
#DGBDSDFTGLECQAFDCDR

After Remove the line with the remark i could start the service

cat /var/lib/rabbitmq/.erlang.cookie
LOBGMGERILECQBFOFTLL 
于 2015-08-06T08:52:00.873 回答
0

Cookie string must have some minimum length content and also the permission of 400. In my case these were the issues once fixed those it worked.

于 2018-04-27T08:41:56.957 回答