rabbitmq / rabbitmq-erlang-client

Erlang client for RabbitMQ
https://www.rabbitmq.com/
Other
184 stars 127 forks source link

some call errors #57

Closed qingchuwudi closed 8 years ago

qingchuwudi commented 8 years ago

I'm trying to use -client , and confused about errors throwed by program. I fllowed system_SUITE:queue_unbind/1 But errors are throwed when setting Exchange and Queue :

%% code
amqp_channel:call(Channel, #'exchange.declare'{exchange = X}),
amqp_channel:call(Channel, #'queue.declare'{queue = Q}),
%%  it throw me same errors again and again:
** Last message in was setup_exchange_queue
** When Server state == {state,
                            {amqp_params_network,<<"username">>,<<"password">>,
                                <<"/">>,"192.168.1.173",5672,0,0,10,infinity, 
                                none,
                                [#Fun<amqp_auth_mechanisms.plain.3>,
                                 #Fun<amqp_auth_mechanisms.amqplain.3>],
                                [],[]},
                            <0.74.0>,<0.83.0>,<<"amq.direct">>,<<"queue">>,
                            <<"my_queue">>,undefined,undefined}
** Reason for termination == 
** {{noproc,{gen_server,call,[<0.83.0>,{close,200,<<"Goodbye">>},infinity]}}, 
    [{gen_server,call,3,[{file,"gen_server.erl"},{line,212}]},
     {mrbq,terminate,2,[{file,"src/mrbq.erl"},{line,244}]},
     {gen_server,try_terminate,3,[{file,"gen_server.erl"},{line,643}]},
     {gen_server,terminate,7,[{file,"gen_server.erl"},{line,809}]},
     {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,240}]}]}
** exception exit: {noproc,
                       {gen_server,call,
                           [<0.83.0>,{close,200,<<"Goodbye">>},infinity]}}

code review amqp_channel.erl

%% call
call/2 -> gen_server:call/2  
handle_call/3 -> handle_method_to_server/6  

goto line 573, then line 888 ,and {noreply, State} returned for call as a result!!

What's wrong with above steps? What should do to make it OK?

I have had tried cast/2,and no errors occur. But this is not what I need.

michaelklishin commented 8 years ago

Please post questions to rabbitmq-users or Stack Overflow. RabbitMQ uses GitHub issues for specific actionable items engineers can work on, not questions. Thank you.

noproc means a process you are trying to use (e.g. a channel process) has terminated. See RabbitMQ log for clues as to why that might be, e.g. you could run into a channel [protocol-level] exception.

qingchuwudi commented 8 years ago

Got it. But on branch : master , module amqp_channel.erl and api amqp_channel:call/2 .

handle_method_to_server/6 return a cast resp to call.