upper limit of 'receive after' timeout

Fredrik Thulin ft@REDACTED
Wed Sep 14 13:24:06 CEST 2005


There appears to be an undocumented upper limit of the timeout value in 
a 'receive after' clause. The documentation 
says "ExprT should evaluate to an integer.". 10 000 000 000 is an 
integer (10 million seconds, around 115 days), but apparently too big 
to be used as ExprT :

$ erl
Erlang (BEAM) emulator version 5.4.8 [source] [hipe]

Eshell V5.4.8  (abort with ^G)
1> receive _ -> ok after 1000 -> io:format("timeout~n") end.
2> T = 10000000 * 1000.
3> is_integer(T).
4> receive _ -> ok after T -> io:format("timeout~n") end.

=ERROR REPORT==== 14-Sep-2005::13:16:29 ===
Error in process <0.30.0> with exit value: {timeout_value,

** exited: {timeout_value,[{erl_eval,receive_clauses,8},
                           {shell,eval_loop,3}]} **

Why do I want to do this? To allow for TCP connections with veery little 
activitiy (on the application layer) over veery long time, but not 
indefinitely. SIP clients behind NATs might need this :(. Perhaps 115 
days is a bit too much, but what is the upper limit of 'receive after'?


More information about the erlang-questions mailing list