Re: keepalive in libpq using

Поиск
Список
Период
Сортировка
От Fujii Masao
Тема Re: keepalive in libpq using
Дата
Msg-id AANLkTike9TXWM0bIIAd-n0K5A73EDqJmDEXFvvwUFtrv@mail.gmail.com
обсуждение исходный текст
Ответ на Re: keepalive in libpq using  (Pavel Golub <pavel@microolap.com>)
Ответы Re: keepalive in libpq using  (Magnus Hagander <magnus@hagander.net>)
Список pgsql-hackers
On Thu, Jul 8, 2010 at 4:57 PM, Pavel Golub <pavel@microolap.com> wrote:
> Sounds good for me. My customer proposed such a scenario:
>
> I have opened connection to database server (ver 8.4.3) through the
> SSH tunnel. This tunnel is created by external program "PUTTY". My PC running Application
> is connected to the ETH switch and server is connected to another port of the switch. So, when
> I disconnect server from the switch, my PC is still online (I mean ETH port have the link). So, my
> local side of the SSH tunnel is still alive, but remote side is down... So no connection to server
> is possible at this moment. But in this scenario, when I do something like this:
>
> PQExec(...);
>
> Application stay locked on this command. Looks like client is still waiting answer from the server in
> the case the TCP connection is still alive, even if Server is not accessible.
>
> The question is: Can this situation be solved with keealives?

AFAIK, keepalive works only if there is no un-Acked data pending.
If network goes down before sending query to server (i.e., calling
PQexec), the ACK for the query doesn't arrive, so you cannot detect
the disconnection via keepalive while waiting for the result of the
query. OTOH, if network goes down after sending query, keepalive
would make you detect the disconnection.

Regards,

-- 
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Pavel Golub
Дата:
Сообщение: Re: keepalive in libpq using
Следующее
От: Magnus Hagander
Дата:
Сообщение: Re: keepalive in libpq using