Re: Full socket send buffer prevents cancel, timeout

From: "Stephen R(dot) van den Berg" <srb(at)cuci(dot)nl>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Fuhr <mike(at)fuhr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Full socket send buffer prevents cancel, timeout
Date: 2008-10-27 16:43:19
Message-ID: 20081027164319.GA26086@cuci.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
>"Stephen R. van den Berg" <srb(at)cuci(dot)nl> writes:
>> What about simply closing the filedescriptor upon discovering a
>> non-empty sendbuffer upon timeout/querycancel?

>So in other words, convert any network glitch, no matter how small,
>into an instant fatal error?

The fact that a timeout or querycancel has taken place, indicates that
this does *not* act on just any network glitch.
The preferred exact logic would look something like:

a. Take note of the time the last write returned as Tlastwritten.
b. Whenever a timeout occurs, or a querycancel is being requested:
c. Check if the sendbuffer is empty.
d. If the sendbuffer is non-empty *and* Tlastwritten is longer ago
than some Tkill (say 128 seconds), then close the filedescriptor.

In all other cases, just hang on tight.
--
Sincerely,
Stephen R. van den Berg.

Teamwork is essential -- it allows you to blame someone else.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-10-27 16:46:53 Re: ERRORDATA_STACK_SIZE exceeded (server crash)
Previous Message Alvaro Herrera 2008-10-27 16:41:42 Re: ERRORDATA_STACK_SIZE exceeded (server crash)