[erlang-questions] gen_server message queue length increasing
Zvi
zvi.avraham@REDACTED
Thu Nov 3 22:14:15 CET 2011
Hi,
I have a locally registered gen_server [1], which traping exits and
monitoring list of processes (which saved in ETS table in it's state).
The priority of this gen_server set to high.
We also use fullsweep_after = 0.
The only job of this gen_server is to spawn gen_servers of other type
and update ETS table with their pids.
The priority of a spawned gen_server process is normal.
For some reason the message queue length of this gen_server start
increasing, whith messages which supposedly should processed by
gen_server:handle_info/2 [2].
Any ideas?
[2]
(mynode@REDACTED)9> whereis(myserver).
<0.194.0>
(mynode@REDACTED)10> i(0,194,0).
[{registered_name,myserver},
{current_function,{proc_lib,sync_wait,2}},
{initial_call,{proc_lib,init_p,5}},
{status,waiting},
{message_queue_len,43388},
{messages,[{'EXIT',<0.17263.1>,normal},
{'DOWN',#Ref<0.0.220.23782>,process,<0.17263.1>,normal},
{'EXIT',<0.19870.0>,normal},
{'DOWN',#Ref<0.0.7.128134>,process,<0.19870.0>,normal},
{'EXIT',<0.19945.0>,normal},
{'DOWN',#Ref<0.0.7.183474>,process,<0.19945.0>,normal},
{'EXIT',<0.19927.0>,normal},
{'DOWN',#Ref<0.0.7.166242>,process,<0.19927.0>,normal},
{'EXIT',<0.19847.0>,normal},
{'DOWN',#Ref<0.0.7.119123>,process,<0.19847.0>,normal},
{'EXIT',<0.19935.0>,normal},
{'DOWN',#Ref<0.0.7.174779>,process,<0.19935.0>,normal},
{'EXIT',<0.17267.1>,normal},
{'DOWN',#Ref<0.0.220.24915>,process,<0.17267.1>,normal},
{'EXIT',<0.19833.0>,normal},
{'DOWN',#Ref<0.0.7.109092>,process,<0.19833.0>,normal},
{'EXIT',<0.19895.0>,normal},
{'DOWN',#Ref<0.0.7.135024>,process,...},
{'EXIT',<0.19906.0>,...},
{'DOWN',...},
{...}|...]},
{links,[<0.14463.0>,<0.1452.1>,<0.28537.1>,<0.6041.2>,
<0.11523.2>,<0.13320.2>,<0.13691.2>,<0.14031.2>,<0.14312.2>,
<0.14363.2>,<0.14502.2>,<0.14514.2>,<0.14518.2>,<0.14523.2>,
<0.14516.2>,<0.14509.2>,<0.14512.2>,<0.14506.2>,<0.14471.2>,
<0.14490.2>|...]},
{dictionary,[{'$ancestors',[router_core_sup,router_sup,
<0.189.0>]},
{'$initial_call',{myserver,init,1}}]},
{trap_exit,true},
{error_handler,error_handler},
{priority,high},
{group_leader,<0.188.0>},
{total_heap_size,1346269},
{heap_size,1346269},
{stack_size,26},
{reductions,3818768},
{garbage_collection,[{min_bin_vheap_size,46368},
{min_heap_size,233},
{fullsweep_after,0},
{minor_gcs,0}]},
{suspending,[]}]
--------------------------------------
[1]
-module(myserver).
-behaviour(gen_server).
...
handle_info({'EXIT', Pid, _}, State) ->
delete_by_pid(Pid, State),
{noreply, State};
handle_info({'DOWN', _, process, Pid, _}, State) ->
delete_by_pid(Pid, State),
{noreply, State};
handle_info(Info, State) ->
{stop, {unknown_info, Info}, State}.
More information about the erlang-questions
mailing list