upper limit of 'receive after' timeout

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


Hi

There appears to be an undocumented upper limit of the timeout value in 
a 'receive after' clause. The documentation 
(http://www.erlang.se/doc/doc-5.4.8/doc/reference_manual/expressions.html#6.10)
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.
timeout
ok
2> T = 10000000 * 1000.
10000000000
3> is_integer(T).
true
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,
[{erl_eval,receive_clauses,8},{shell,exprs,6},{shell,eval_loop,3}]}

** exited: {timeout_value,[{erl_eval,receive_clauses,8},
                           {shell,exprs,6},
                           {shell,eval_loop,3}]} **
5> 

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'?

/Fredrik



More information about the erlang-questions mailing list