[erlang-questions] Too many processes

Bengt Kleberg bengt.kleberg@REDACTED
Mon Apr 20 09:16:43 CEST 2009


Greetings,

The tail recursion for the message {packet, Packet} is good.
The other two messages makes parse_packet/2 return, stopping the
recursion. The argument Client is not used and could be removed.


Presumably the too many processes are created somewhere else in your
code.


bengt

On Fri, 2009-04-17 at 06:00 -0700, marmll wrote:
> Hi, 
> 
> i have the following problem:
> 
> My error_logger tells me that I’am having “Too many processes” and the
> erlang engine crashed. 
> When I’am starting the gen_server I’am checking the
> erlang:system_info(process_count) and they tells me 80 processes.
> 
> Codesnip from init:
>     F = fun(Sock) -> parse_packet(Sock, Client) end,
>     tcp_server:stop(Port),
>     {ok, _} = tcp_server:start_raw_server(Port, F, 10240,2048),
> 
> And here my parse_packet:
> 
> parse_packet(Socket, Client) ->
>     receive
>                 {tcp, Socket, Bin} ->
>                     io:format("--> ~w~n", [Bin]);
>                 {tcp_closed, Socket} ->
>                     error_logger:error_report([{module, ?MODULE},{line,
> ?LINE},{message, "tcpclosed"},{call, "tcp_closed aus
> receive"},{now,now()}]);
>                 {packet, Packet} ->
>                     io:format("<-- ~w~n", [Packet]),
>                     parse_packet(Socket, Client)
> end.
> 
> With every connect to the server my process_count is increasing 1 ! 
> 
> How can I handle the process_count ? I think the the tail recursion at
> parse_packet is not good. 
> 
> Please help me 
> Thanks 
> 
> -- 
> View this message in context: http://www.nabble.com/Too-many-processes-tp23097100p23097100.html
> Sent from the Erlang Questions mailing list archive at Nabble.com.
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list