Re: Psql or test application hangs when interface is down for the DB server

From: "K, Niranjan (NSN - IN/Bangalore)" <niranjan(dot)k(at)nsn(dot)com>
To: "ext Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-bugs(at)postgresql(dot)org>, "Gregory Stark" <stark(at)enterprisedb(dot)com>
Subject: Re: Psql or test application hangs when interface is down for the DB server
Date: 2008-07-25 11:54:36
Message-ID: 39C6C93FC1236641B94D3648B96E3BE70186A760@inbhexc001.nsn-intra.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Isn't it not possible to check that the connectivity is broken in
advance and if so, wait on the socket would not be required.

If we have to timeout (even 1-2 seconds), it will be pretty long for the
highly available applications.

Is there any way to check the health of the interface?

regards,
Niranjan

-----Original Message-----
From: ext Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Wednesday, July 16, 2008 8:03 PM
To: Gregory Stark
Cc: K, Niranjan (NSN - IN/Bangalore); pgsql-bugs(at)postgresql(dot)org
Subject: Re: [BUGS] Psql or test application hangs when interface is
down for the DB server

Gregory Stark <stark(at)enterprisedb(dot)com> writes:
> "K, Niranjan (NSN - IN/Bangalore)" <niranjan(dot)k(at)nsn(dot)com> writes:
>> Is there any other workaround or alternative so that the situation
>> about the interface is down is known and based on that the 'PQexec'
>> does not get blocked for ~15 minutes.

> Absent threads I think you have to use alarm() and a SIGALRM signal
handler.

On most modern platforms you can adjust the TCP timeouts for the
connection. There's no explicit support for that in libpq, but you can
just get the socket FD from it and do setsockopt().

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message valgog 2008-07-25 14:15:36 Re: BUG #4319: lower()/upper() does not know about UNICODE case mapping
Previous Message Zdenek Kotala 2008-07-25 08:17:56 Re: BUG #4319: lower()/upper() does not know about UNICODE case mapping