Bug 46291

Summary: correlation between HZ kernel config parameter and socket timeouts is not documented
Product: Documentation Reporter: Rashid N. Achilov <shelton>
Component: Books & ArticlesAssignee: ru <ru>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Rashid N. Achilov 2002-12-16 14:30:01 UTC
man setsockopt(2), FreeBSD Handbook and FreeBSD FAQ have missed a correlation
between HZ kernel configuration parameter and maximal timeout, accessible to
setsockopt() function, when try to set SO_SNDTIMEO or SO_RCVTIMEO. This
correlation defined in ~sys/kern/uipc_socket.c in function sosetopt() and is
SHRT_MAX / HZ. When HZ set to 1000 (advisable to DEVICE_POLLING), maximum
timeout value shorted from 327 sec to 32 sec without any notification. Also
I think, EDOM is not suitable error code
this occassion.

Fix: 

Delete HZ option in kernel config file or do not use socket timeouts more than
SHRT_MAX / HZ (rounded to short int)
How-To-Repeat: Include in your kernel config line

HZ = 1000

recompile kernel, reload kernel and try to set socket timeout more than 32 sec.
System replied: Numerical domain out or range. Which correlation has a math
error to socket operation?
Comment 1 ru freebsd_committer freebsd_triage 2006-10-21 22:05:47 UTC
State Changed
From-To: open->closed

In FreeBSD 5 and later, the limit was changed to INT_MAX / HZ which 
makes it more practical with large (sane) values of HZ such as 1000. 

The EDOM is required by POSIX. 


Comment 2 ru freebsd_committer freebsd_triage 2006-10-21 22:05:47 UTC
Responsible Changed
From-To: freebsd-doc->ru