Re: BUG #14720: getsockopt(TCP_KEEPALIVE) failed: Option not supported by protocol
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: lizenko79@gmail.com, pgsql-bugs@postgresql.org
Date: 2017-06-27T20:16:53Z
Lists: pgsql-bugs
Alvaro Herrera <alvherre@2ndquadrant.com> writes: > lizenko79@gmail.com wrote: >> I've got the following message running PostgreSQL 9.6.3 on Solaris 11.3 >> (both latest stable). >> getsockopt(TCP_KEEPALIVE) failed: Option not supported by protocol > It sounds like your system defines the TCP_KEEPALIVE symbol at compile > time but the kernel doesn't know it; maybe the package was compiled in a > system where the kernel does support that option, and you're running it > in one that doesn't? Actually, I find the same error in the logs for our Solaris buildfarm members. So apparently that's been going on since day one, and we hadn't noticed it, though I now find that it's been reported before: https://www.postgresql.org/message-id/CAJgtxT6QL0_Gt+TkSDw=q1=YVJkT73FoSrtStcu5Hy+-SXn8rw@mail.gmail.com Some googling turned up the tcp(7P) man page for Solaris 11: https://docs.oracle.com/cd/E36784_01/html/E36884/tcp-7p.html#REFMAN7tcp-7p and it says this: SunOS supports the keep-alive mechanism described in RFC 1122. It is enabled using the socket option SO_KEEPALIVE. When enabled, the first keep-alive probe is sent out after a TCP is idle for two hours. If the peer does not respond to the probe within eight minutes, the TCP connection is aborted. You can alter the interval for sending out the first probe using the socket option TCP_KEEPALIVE_THRESHOLD. The option value is an unsigned integer in milliseconds. The system default is controlled by the TCP ndd parameter tcp_keepalive_interval. The minimum value is ten seconds. The maximum is ten days, while the default is two hours. If you receive no response to the probe, you can use the TCP_KEEPALIVE_ABORT_THRESHOLD socket option to change the time threshold for aborting a TCP connection. The option value is an unsigned integer in milliseconds. The value zero indicates that TCP should never time out and abort the connection when probing. The system default is controlled by the TCP ndd parameter tcp_keepalive_abort_interval. The default is eight minutes. So apparently, Linux's TCP_KEEPIDLE corresponds to Solaris' TCP_KEEPALIVE_THRESHOLD. TCP_KEEPINTVL and TCP_KEEPCNT seem to have no direct equivalent, although TCP_KEEPALIVE_ABORT_THRESHOLD would correspond to their product. I suggest that we ought to expand the keepalive code to know about this synonym. regards, tom lane
Commits
-
Second try at fixing tcp_keepalives_idle option on Solaris.
- e97b7372bf94 9.4.13 landed
- cc154d9a0022 9.3.18 landed
- 99255d73c07c 10.0 landed
- 63f5db8ab7e7 9.5.8 landed
- 5e7447132000 9.2.22 landed
- 43c67e32fb29 9.6.4 landed
-
Support tcp_keepalives_idle option on Solaris.
- f0256c774daa 10.0 landed
- d16e96fb2aa1 9.5.8 landed
- c2cb606a2ead 9.4.13 landed
- 9ce7f39195dc 9.3.18 landed
- 6ccab9242b34 9.2.22 landed
- 55968ed89496 9.6.4 landed