[erlang-questions] gen_server doesn't respond
Attila Rajmund Nohl
attila.r.nohl@REDACTED
Tue Jun 4 11:03:58 CEST 2013
2013/6/4 Park, Sungjin <jinni.park@REDACTED>:
> Shell input/output logs below.
>
> ============================
> 4> process_info(pid(0,453,4757)).
> [{current_function,{gen,do_call,4}},
> {initial_call,{proc_lib,init_p,5}},
> {status,waiting},
> {message_queue_len,1},
> {messages,[{'$gen_call',{<0.26172.4841>,
> #Ref<0.0.2946.93178>},
> state}]},
> {links,[<0.25337.4839>]},
> {dictionary,[{'$ancestors',[<0.452.4757>,<0.424.0>,
> <0.423.0>,ranch_sup,<0.420.0>]},
> {'$initial_call',{my_session,init,1}}]},
> {trap_exit,true},
> {error_handler,error_handler},
> {priority,normal},
> {group_leader,<0.419.0>},
> {total_heap_size,1364},
> {heap_size,987},
> {stack_size,32},
> {reductions,1487},
> {garbage_collection,[{min_bin_vheap_size,46368},
> {min_heap_size,233},
> {fullsweep_after,65535},
> {minor_gcs,8}]},
> {suspending,[]}]
> =============================
>
> As you can see the process has a message {..., state} in it's message queue
> but still in waiting state. It doesn't respond to gen_server:call(Pid,
> state) from this point on. The process_info shows that the process is now
> in gen:do_call/4 which is not under my control. The module has all the
> fallback handlers for handle_call/3, handle_cast/2, handle_info/2 etc, so
> that every message be matched. There are a couple of places in my project
> where gen_server:call/2 used against this process. I suppose that the calls
> should timeout in 5 sec by default as is stated in the gen_server
> specification. So there should be no such case that the process stuck
> indefinitely.
Check process_info(Pid, backtrace) to see that which gen_server:call
(in your gen_server) is blocked. Then check that gen_server, maybe
that calls back to your gen_server or something like that.
More information about the erlang-questions
mailing list