[rabbitmq-discuss] Just publishing messages causes rabbit_writer:mainloop to hang and simultaneous pub problem

Ben Hood 0x6e6562 at gmail.com
Mon Apr 14 22:00:46 BST 2008


Joe,

A cursory glance indicates that you are using the wrong routing key to  
publish to the exchange.

If you use a.b.c.d instead of a.b.c.*, then when a queue binds itself  
to a.b.c.*, messages will be delivered to it.

Hence why you are getting a get_empty.

So just change the routing key in the amqp_async_pub module.

As for the errors you are seeing, the reason is because you are  
passing in integers as the publish payload.

The API however, expects payload fragments to be opaque binaries  
rather than any Erlang type.

So to fix this problem, just convert whatever payload fragment you  
want to send to a binary.

In your case you are sending integers, so you could pass in something  
like <<MyInteger:32>> instead of MyInteger.

This may be a question for the design of the API. It may well be  
worthwile performing a guard condition (i.e. is_binary(Payload)) on  
the submission of a message. I'll look into this.

BTW, if you don't supply a host name when starting the connection, the  
client will start in a direct mode using native Erlang message passing  
rather than AMQP wire framing. This means that the client and server  
run in the same interpreter and eliminate the network overhead.

HTH,

Ben

On 14 Apr 2008, at 18:59, Joe Lee wrote:

> Here are the files.  I think problem maybe how the Payload in  
> amqp_async_pub is assigned setup.  I maybe wrong.
>
> Joe
>
> On Mon, Apr 14, 2008 at 11:39 AM, Ben Hood <0x6e6562 at gmail.com> wrote:
> Hi Joe,
>
> Could you send the complete source code of the test that causes  
> these problems so that we can have a look at this, please?
>
> Thx,
>
> Ben
>
> On 14 Apr 2008, at 16:20, Joe Lee wrote:
>> I tried to send messages sequentially to a single rabbitmq server  
>> running on 127.0.0.1.  After sending messages around 32000, erlang  
>> client node publishing the message crashed.  When I looked at the  
>> crash dump, I see close to 32767 rabbit_writer:mainloop/1 process  
>> still in waiting status.  I am not sure why so many  
>> rabbit_writer:mainloop processes are still hanging around.   
>> Furthermore, I started another node to get published message from  
>> rabbitmq server, rabbitmq server sends basic.get_empty.
>>
>> crash_dump.erl says:
>> Maximum number of Erlang Process has reached 32768
>>
>> Process status in erlang crash dump:
>>
>> <0.32765.6>    rabbit_writer:mainloop/1    Waiting    136    233    0
>> <0.32766.13>    rabbit_writer:mainloop/1    Waiting    132     
>> 233    0
>> <0.32767.1>    rabbit_writer:mainloop/1    Waiting    136    233    0
>>
>>
>> I tried spawning 3 erlang processes simultaneously to publish  
>> message using pmap to a single rabbitmq_server running on 127.0.0.1  
>> and rabbitmq server throws badarg error.  Here is the error below:
>>
>> =ERROR REPORT==== 14-Apr-2008::19:43:23 ===
>> Error in process <0.68.0> on node 'test at home' with exit value:  
>> {badarg,[{erlang,size,[1]}, 
>> {rabbit_binary_generator,build_content_frames,5}, 
>> {rabbit_binary_generator,build_simple_content_frames,3}, 
>> {rabbit_writer,assemble_frames,4}, 
>> {rabbit_writer,internal_send_command_async...
>>
>>
>> =ERROR REPORT==== 14-Apr-2008::19:43:23 ===
>> Error in process <0.70.0> on node 'test at home' with exit value:  
>> {badarg,[{erlang,size,[3]}, 
>> {rabbit_binary_generator,build_content_frames,5}, 
>> {rabbit_binary_generator,build_simple_content_frames,3}, 
>> {rabbit_writer,assemble_frames,4}, 
>> {rabbit_writer,internal_send_command_async...
>>
>>
>> =ERROR REPORT==== 14-Apr-2008::19:43:23 ===
>> Error in process <0.69.0> on node 'test at home' with exit value:  
>> {badarg,[{erlang,size,[2]}, 
>> {rabbit_binary_generator,build_content_frames,5}, 
>> {rabbit_binary_generator,build_simple_content_frames,3}, 
>> {rabbit_writer,assemble_frames,4}, 
>> {rabbit_writer,internal_send_command_async...
>>
>> Have a look into this one: closed
>> Have a look into this one: closed
>> Have a look into this one: closed
>> (test at home)2>
>>
>> I am not sure what these errors mean.  Can someone tell me what I  
>> am doing wrong?
>>
>> Thank you,
>> Joe
>> _______________________________________________
>> rabbitmq-discuss mailing list
>> rabbitmq-discuss at lists.rabbitmq.com
>> http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>
> < 
> amqp_async_consume 
> .erl><amqp_async_pub.erl><my_pmap.erl><rabbit_test.erl>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20080414/844847af/attachment.htm 


More information about the rabbitmq-discuss mailing list