public inbox for [email protected]  
help / color / mirror / Atom feed
From: Laurenz Albe <[email protected]>
To: jiye <[email protected]>
To: [email protected]
Subject: Re: FDW connection drops with "Connection timed out" during async append query due to TCP receive buffer filling up
Date: Tue, 10 Mar 2026 18:16:04 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

On Tue, 2026-03-10 at 18:17 +0800, jiye wrote:
> I encountered an issue with foreign table asynchronous scans.
> 
> I'm testing on PostgreSQL 17 in a Windows WSL environment, with TCP keepalive settings configured as follows:
> configure:
> > tcp_keepalives_idle = 2
> > tcp_keepalives_interval = 2
> > tcp_keepalives_count = 3
> > tcp_user_timeout = 9
> > 
> The foreign table was created with:
> sql:
> > CREATE TABLE ftab (a int, data varchar);
> I inserted test data using:
> sql:
> > INSERT INTO ftab 
> > SELECT generate_series(1, 10000), 
> >        substring(md5(random()::text) || repeat(md5(random()::text), 127), 1, 40960);
> Then I executed an async append query that unions with a simple query:
> sql:
> > SELECT f1(), 'local-data' 
> > UNION ALL 
> > SELECT * FROM f_ftab 
> > LIMIT 2;
> Note: f1() is a function that sleeps for 10 seconds, created by:
> sql
> > CREATE OR REPLACE FUNCTION f1() 
> > RETURNS integer 
> > LANGUAGE plpgsql AS $$
> > BEGIN 
> >     PERFORM pg_sleep(10); 
> >     RETURN 1; 
> > END; $$;
> The abnormal behavior was reproduced: the foreign data server connection was disconnected, with the following error logs:
> text
> > 2026-03-10 17:52:55.969 CST [820] LOG: statement: FETCH 100 FROM c1
> > 2026-03-10 17:52:56.495 CST [820] LOG: could not receive data from client: Connection timed out
> > 2026-03-10 17:52:56.495 CST [820] LOG: unexpected EOF on client connection with an open transaction

I am not a network expert, but if you set tcp_user_timeout = 9, why are you surprised if the
connection times out after 9 seconds?

Yours,
Laurenz Albe






reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: FDW connection drops with "Connection timed out" during async append query due to TCP receive buffer filling up
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox