Anyone else needs a gen_tcp:send with timeout ?
Mickael Remond
mickael.remond@REDACTED
Fri Jan 27 15:43:26 CET 2006
Hello,
We have seen several time in live system that a gen_tcp:send with
timeout is really really needed.
Suppose you write a server that periodically send data to a client.
A client is connected but gets suspended at some point (Ctrl-Z or
deadlock, etc.).
In this case the server will keep on trying to send the data to the
client. Packets are queued in the Erlang VM and the memory consumption
grows to the point where
Eric Newhuis asked for this feature one year ago:
http://www.erlang.org/ml-archive/erlang-questions/200401/msg00327.html
Scott Lystig Fritchie earlier.
Matthias suggested to use the undocumented:
gen_tcp:connect(Host, Port, [{send_timeout, 0}])
(or to use a timer).
I do not know if Eric, Scott or someone else has found a good and robust
way to handle thoses cases.
How do you do in your production servers ?
Do you use one of the previous trick ?
Is the addition of a gen_tcp:send with timeout considered ?
Thank you for your best practice :-)
--
Mickaël Rémond
http://www.process-one.net/
More information about the erlang-questions
mailing list