-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specify how to disable timeouts #4069
Conversation
Of course I had to forget something, and it was So I think we could safely make zero no longer special, and in that case have a 1ms timed wait, or less. |
9e3283f
to
0a2f97d
Compare
From now on, INFINITY disables the timeout and NAN is no longer allowed. Refs varnishcache#3045
For all intents and purposes, it currently is exactly the same as the timeout tweak. The duration parameters are either not really timeouts, or timeouts that cannot be disabled. In other words, the timeout tweak will grow the ability to formally disable a timeout. Refs varnishcache#3045
The timeout type is the authority from which both the tweak and flag are derived.
They were already relying on NAN to fall back to parameters.
We can't use NAN in VGC code today, so in order to convey the lack of timeout setting in a backend definition, only a negative value makes sense since zero will eventually mean zero instead of undefined. This is an implicit breakage of the VRT ABI for the meaning of struct vrt_backend.
Unlike session timeouts, they were not falling back to their parameter counterparts from NAN. Since NAN is not allowed in VCL, they now behave like session timeouts, returning their value or falling back to the parameter when unset.
The vtim_real in Lck_CondWaitUntil() is not meant to be INFINITY, and it should only apply to the vtim_dur passed to Lck_CondWaitTimeout(). In practice it does since the latter calls the former. It could be enforced by extracting a static function from Lck_CondWaitUntil(). This accommodates a few timeout parameters that are used for cond waits.
The timeout_* parameters are used in duration arithmetics and the simplest is to not grant them the ability to be disabled. Both timeout_idle and idle_send_timeout appear in a CondWait context. For this reason both need to be capped to 1h, matching the implicit limit in Lck_CondWaitTimeout().
Following consensus, this patch series formalizes several things:
NAN
means that a timeout is not set (only possible in VCL, parameters must have a default value)unset
timeout variables in VCLsess.*timeout*
)INFINITY
disables a timeoutVRT_DECIMAL_MAX
in VCLpoll(2)
case it translates to -1 (akaINFTIM
)setsockopt(2)
case it translates to a zero timevalsetsockopt(2)
translates to a 1us timeout (should it be 1ms?)bereq
timeouts have two levels of fallbackINFINITY
(nomath.h
)I tried to be as thorough as possible, following the trail of relevant timeout parameters.
Fixes #3045