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

Fisher Yu fisher at yun.io
Wed Aug 3 04:31:27 BST 2011


2011/8/2 Alexandru Scvorţov <alexandru at rabbitmq.com>

> 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.
>

Changed this, thanks.


>
> 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?
>

There is nothing happening in the server logs, at least nothing being
raised.  There is 24G RAM in here, with about 4G active and 11G free at the
time of testing.



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


The distribution is Ubuntu 10.04,
uname -a
Linux fs21 2.6.32-31-generic #61-Ubuntu SMP Fri Apr 8 18:25:51 UTC 2011
x86_64 GNU/Linux

Erlang version
Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:24:24] [rq:24]
[async-threads:0] [kernel-poll:false]

This machine is almost completely idle at the moment as it's a development
server.  There is nothing special for the configuration.


>
> >   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?
>

Every time the test case is run, this error is produced.


>
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110803/a0941cea/attachment.htm>


More information about the rabbitmq-discuss mailing list