Re: BUG #14720: getsockopt(TCP_KEEPALIVE) failed: Option not supported by protocol

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, lizenko79(at)gmail(dot)com, PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14720: getsockopt(TCP_KEEPALIVE) failed: Option not supported by protocol
Date: 2017-06-27 22:48:56
Message-ID: CAB7nPqTjucafvkZGusT2aJp2gHivgwxoEOBxQoSUPhKrEU41ew@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Jun 28, 2017 at 7:26 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Concretely, something like the attached. I have no way to test this
> locally, so I'm thinking of just pushing it and seeing what the buildfarm
> says.

! #if defined(TCP_KEEPIDLE)
! /* TCP_KEEPIDLE is the name of this option on Linux and *BSD */
if (setsockopt(port->sock, IPPROTO_TCP, TCP_KEEPIDLE,
(char *) &idle, sizeof(idle)) < 0)
{
elog(LOG, "setsockopt(TCP_KEEPIDLE) failed: %m");
return STATUS_ERROR;
}
! #elif defined(TCP_KEEPALIVE_THRESHOLD)
What about defining a PG_TCP_KEEPALIVE instead?

Side note: Windows has something with a different set of options:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms740476(v=vs.85).aspx
--
Michael

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2017-06-27 23:09:58 Re: BUG #14720: getsockopt(TCP_KEEPALIVE) failed: Option not supported by protocol
Previous Message Tom Lane 2017-06-27 22:26:41 Re: BUG #14720: getsockopt(TCP_KEEPALIVE) failed: Option not supported by protocol