[rabbitmq-discuss] RabbitMQ Erlang API questions

Lev Walkin vlm at lionet.info
Wed Apr 8 15:55:26 BST 2009


I've started using Erlang native API to RabbitMQ recently (cloned out of 
v1_5 branch) and found a couple of issues I'd like someone "in the know" 
to clarify:

1. lib_amqp:close_channel(lib_amqp:start_channel()) leaks processes:

8> {now(), begin [lib_amqp:close_channel(lib_amqp:start_channel(Connection))
	|| _ <- lists:seq(1, 5000)], ok end, now()}.
{{1239,202072,747808},ok,{1239,202075,812575}}
9> length(processes()). 
         5031
10> {now(), begin 
[lib_amqp:close_channel(lib_amqp:start_channel(Connection))
	|| _ <- lists:seq(1, 5000)], ok end, now()}.
{{1239,202086,803935},ok,{1239,202089,761556}}
11> length(processes()). 
         10031
12>

Is it a normal intended behavior or something's wrong? I strongly 
believe it is wrong, because the channel itself is not alive after closing:

	1> length(processes()).
	24
	2> Connection = lib_amqp:start_connection("test-amqp").
	<0.33.0>
	3> Ch = lib_amqp:start_channel(Connection).
	<0.40.0>
	4> lib_amqp:close_channel(Ch).
	ok
	5> length(processes()).
	31
	6> is_process_alive(Ch).
	false
	7>

Moreover, if you close the Connection or restart the remote AMQP server, 
these thousands of processes won't go away:

	12> is_process_alive(Connection).
	true
	Broker forced connection: 320 -> <<"CONNECTION_FORCED - broker forced 
connection closure with reason 'shutdown'">>
	13> is_process_alive(Connection).
	false
	14> length(processes()). 
          	10027
	15>

	1> Connection = lib_amqp:start_connection("test-amqp").
	<0.37.0>
	2> {now(), begin 
[lib_amqp:close_channel(lib_amqp:start_channel(Connection))
		|| _ <- lists:seq(1, 5000)], ok end, now()}.
	{{1239,202400,604255},ok,{1239,202403,778267}}
	3> lib_amqp:close_connection(Connection).
	ok
	4> length(processes()).
	5026
	5>



2. One can not create a durable exclusive queue, that is, the following 
call does not result in a queue that persists between server app 
reloads. The queue _is_ created, but is not there after server restart.

         lib_amqp:declare_queue(Channel, #'queue.declare'{
                 queue = Q,
                 passive = false,
                 durable = true,		% NOTE
                 exclusive = true,	% NOTE
                 auto_delete = false,
                 nowait = false,
                 arguments = []
         }).


Please could someone comment on what's going on?

-- 
Lev Walkin
vlm at lionet.info




More information about the rabbitmq-discuss mailing list