Re: Full socket send buffer prevents cancel, timeout - Mailing list pgsql-hackers

From Stephen R. van den Berg
Subject Re: Full socket send buffer prevents cancel, timeout
Date
Msg-id 20081027164319.GA26086@cuci.nl
Whole thread Raw
In response to Re: Full socket send buffer prevents cancel, timeout  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Full socket send buffer prevents cancel, timeout
List pgsql-hackers
Tom Lane wrote:
>"Stephen R. van den Berg" <srb@cuci.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.


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: ERRORDATA_STACK_SIZE exceeded (server crash)
Next
From: Charles Duffy
Date:
Subject: Re: Making pg_standby compression-friendly