Maximum GenServer timeout

genserver
otp

#1

I just found out the hard way that the maximum genserver timeout is 2^32-1, 4294967295 milliseconds, which is roughly 49 days. Does anybody know why that is? I’m not sure it is documented somewhere. If you specify a timeout value that is higher than that, the server process crashes with a timeout_value exit message.

Of course such timeouts are quite ridiculous, but it’s also strange that it is not documented, it only says Timeout = int()>0 | infinity; or, does int() somehow imply a 32-bit integer?

BTW I created a little test module to check at what value the crash occurs.


#2

Because gen_server is implemented using a normal receive loop it is mentioned there: http://erlang.org/doc/reference_manual/expressions.html#receive

"ExprT is to evaluate to an integer. The highest allowed value is 16#FFFFFFFF"

I agree though that it would have been clearer if this was documented in the man pages as well. I guess the reason is because of underlying implementation in C must be an int32