Re: Psql or test application hangs when interface is down for the DB server - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Psql or test application hangs when interface is down for the DB server
Date
Msg-id 7848.1216218787@sss.pgh.pa.us
Whole thread Raw
In response to Re: Psql or test application hangs when interface is down for the DB server  (Gregory Stark <stark@enterprisedb.com>)
Responses Re: Psql or test application hangs when interface is down for the DB server
List pgsql-bugs
Gregory Stark <stark@enterprisedb.com> writes:
> "K, Niranjan (NSN - IN/Bangalore)" <niranjan.k@nsn.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

pgsql-bugs by date:

Previous
From: Gregory Stark
Date:
Subject: Re: Psql or test application hangs when interface is down for the DB server
Next
From: Valentin Bogdanov
Date:
Subject: Re: Psql or test application hangs when interface is down for the DB server