[rabbitmq-discuss] Error while connect to rabbitmq using rabbitmq-erlang-client library

Alexandru Scvorţov alexandru at rabbitmq.com
Tue Aug 2 15:09:12 BST 2011


Hi,

> ** Reason for termination ==
> ** {{badmatch,{error,enomem}},
>     [{amqp_main_reader,handle_inet_async,2},
>      {gen_server,handle_msg,5},
>      {proc_lib,init_p_do_apply,3}]}

Strictly speaking, that means you've run out of memory.  Not sure how
that could happen, though.

There's an error in your example:

>         Get = #'basic.get'{queue = Queue},

should be

>         Get = #'basic.get'{queue = list_to_binary(Queue)},

Actually, you'd probably be better off converting Queue to a binary from
the start.

Still, the failure is during the initial handshake, so that can't be the
cause.

Have a look in the server logs: is there a matching error?  Is there any mention
of the memory alarms being set off?

What OS are you using?  What version of Erlang?  Is there anything
special about the system's configuration?  Is it under heavy load?

>   I kept get error message while connect to rabbitmq server using
> rabbitmq-erlang-client library. Anyone can help, thanks.

Does this mean you *always* get this error?  Or only occasionally?

Cheers,
Alex

On Tue, Aug 02, 2011 at 09:43:46PM +0800, Fisher Yu wrote:
> Hi
> 
>   I kept get error message while connect to rabbitmq server using
> rabbitmq-erlang-client library. Anyone can help, thanks.
> 
> Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:24:24] [rq:24]
> [async-threads:0] [kernel-poll:false]
> Eshell V5.8.4  (abort with ^G)
> 1> test:start().
> =ERROR REPORT==== 2-Aug-2011::08:40:18 ===
> ** Generic server <0.46.0> terminating
> ** Last message in was
> {inet_async,#Port<0.1109>,1,{ok,<<65,77,81,80,1,1,8>>}}
> ** When Server state == {state,#Port<0.1109>,<0.39.0>,<0.41.0>,
>                                {method,rabbit_framing_amqp_0_9_1},
>                                none}
> ** Reason for termination ==
> ** {{badmatch,{error,enomem}},
>     [{amqp_main_reader,handle_inet_async,2},
>      {gen_server,handle_msg,5},
>      {proc_lib,init_p_do_apply,3}]}
> 
> 
> 
> %%test.erl
> 
> -module(test).
> -include_lib("amqp_client/include/amqp_client.hrl").
> -compile(export_all).
> start() ->
>         {ok, Connection} =
> amqp_connection:start(#amqp_params_network{username= <<"myuser">>, password=
> <<"mypassword">>}),
>         {ok, Channel} = amqp_connection:open_channel(Connection),
>         Queue = "my_queue",
>         Declare = #'queue.declare'{queue = list_to_binary(Queue),
> durable=true},
>         #'queue.declare_ok'{} = amqp_channel:call(Channel, Declare),
>         Get = #'basic.get'{queue = Queue},
>         {#'basic.get_ok'{delivery_tag = Tag}, Content}
>                        = amqp_channel:call(Channel, Get),
>         io:format("received message ~p", [Content]),
>         %% Close the channel
>         amqp_channel:close(Channel),
>         %% Close the connection
>         amqp_connection:close(Connection),
>         ok.

> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss



More information about the rabbitmq-discuss mailing list