Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
net: setKeepAlivePeriod may be wrong on Solaris #9614
In revision f956740 the function setKeepAlivePeriod in the net package was changed on Solaris to use TCP_KEEPIDLE and TCP_KEEPINTVL. However, I am told that on Solaris 11.2, those symbols are not defined. They are defined in our syscall package because they are defined on Illumos, which is derived from OpenSolaris. If we want Go to have support for Solaris proper, not just OpenSolaris, we should probably go back to the earlier Solaris-specific version of setKeepAlivePeriod.
The problem here is that it impossible to perfectly emulate TCP_KEEPINTVL + TCP_KEEPIDLE using TCP_KEEPALIVE_THRESHOLD and TCP_KEEPALIVE_ABORT_THRESHOLD.
Generally speaking, TCP_KEEPALIVE_ABORT_THRESHOLD = TCP_KEEPCNT * TCP_KEEPINTVL, however, when using TCP_KEEPALIVE_ABORT_THRESHOLD, Solaris will not send probes at equal intervals, but will use an exponential backoff algorithm. That is not what we want.
If it's "good enough", and we decide to go with it, we need to find a good value for TCP_KEEPCNT. I don't know what a good value is.
Unfortunately Oracle Solaris does not have TCP_KEEPIDLE and TCP_KEEPINTVL. TCP_KEEPIDLE is equivalent to TCP_KEEPALIVE_THRESHOLD, but TCP_KEEPINTVL does not have a direct equivalent, so we don't set TCP_KEEPINTVL any more. Old Darwin versions also lack TCP_KEEPINTVL, but the code tries to set it anyway so that it works on newer versions. We can't do that because Oracle might assign the number illumos uses for TCP_KEEPINTVL to a constant with a different meaning. Unfortunately there's nothing we can do if we want to support both illumos and Oracle Solaris with the same GOOS. Updates #9614. Change-Id: Id39eb5147f7afa8e951f886c0bf529d00f0e1bd4 Reviewed-on: https://go-review.googlesource.com/7690 Reviewed-by: Minux Ma <email@example.com> Reviewed-by: Mikio Hara <firstname.lastname@example.org>
A future release of Solaris now supports these interfaces in a Linux-compatible way, so perhaps once a path for issue #15227 is figured out, we can figure out a way to use these on Solaris as well if they are available.
As an example, the values on a development version of Solaris are currently:
...while they are this on some OpenSolaris-based derivatives: