Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w0C95-001hLo-01 for pgsql-bugs@arkaria.postgresql.org; Wed, 11 Mar 2026 05:30:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w0C93-007WwS-0e for pgsql-bugs@arkaria.postgresql.org; Wed, 11 Mar 2026 05:30:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w0C92-007WwK-2w for pgsql-bugs@lists.postgresql.org; Wed, 11 Mar 2026 05:30:09 +0000 Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w0C90-000000025HQ-2Rfq for pgsql-bugs@lists.postgresql.org; Wed, 11 Mar 2026 05:30:08 +0000 Received: by mail-ot1-x329.google.com with SMTP id 46e09a7af769-7d75e74f5adso1345755a34.3 for ; Tue, 10 Mar 2026 22:30:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773207004; cv=none; d=google.com; s=arc-20240605; b=YvFQKEh12GQONUaJaeLora2dgkf1LMJy6R74SExWesy2mKvD46Fu8/1Z7qc58/Qlxu bcNgZgPs5LUVgiiX5eAGATejAid/DJQTnYf/RCJRk+1ZXVbvNT2vqq2bFOqkQ+VjOyhb q8IXXQjqD6zuvlFFT6vc4CJRn5WSvcfTuSBYDnyNOsZ4ygSdcVVuBYgULaBCxniFDY5I x650ppZdEbK/37pu1Co5L9QzoDbOzOB05oRyo91Z4njRL7sQsUUhWkGG7olAg+IpJ4WW xaOBzOX3AHK2gKTDI6rqRIrhwDc5j88Cxy62Du0LTWe9CNwZBC0Ia8u9DdrIF+ZUqKEy pDOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:dkim-signature; bh=yMiEC4s5Zy2ROMM8JYQnh8H/Wz1M/LTwsc1zpfGD7ik=; fh=4Uv6M8I9vemEoageqbfbl24XyC0VnCl7yofWRnUjuMM=; b=igb6sqg3DP92yHKWTspeHhtqJ9GicLyAHTzlCphi48Dt6GTGpDRAj0IsDkfgOpOtzk Y8g5XQCuIDWi66mo0TC5PJ+CM5DcSSY+dtb1XCM0a+kFnDNc/miuP2k2jzD+LW4qmE6M BJL7K5Ih8M5QudY+NJ9RwGt3UeB0RBf4wJ7yL/txCg/GYBREEXtSrM+TpxTQVWnMXOyD W3q5UC7iuNA5CeaRDi9PRoMWxbjsWP4wUnhh3SllAEwxYK2jWdxhsA9vgexYgOAjDeJg 8NtAaG09mA6yn2n1m0rUvtBAYAq2lfwb5tcTDeIwRSQM64pMDWef+xU8tqR+hBA6fyK4 yIfg==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773207004; x=1773811804; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=yMiEC4s5Zy2ROMM8JYQnh8H/Wz1M/LTwsc1zpfGD7ik=; b=TKM1fyPIBefQVbUUjf8r9iVrTdPDEioUfQnqEMjGfYjfujg3jC4cyCCDgFyzx4QUgV mmojDWWnNaHj2D3Ap0MPUO+JdUD2yJ+gDT1V3w7RUhRIEsvWPwv0WHtpUtS8q/Xe10IY Aa7Z0J52JJWVzQOgRwkEptPkE9KhEh+kmOsgoICOSY5606U322vmhYgIe6UhvbyVQQEB bwvGCYh06zVpKFq7MDRXjOGeXwGIhPxZJcQA+QiUD9DGheK3MXLMVki5Z6SvLBnkI4ic 4bn7RY/eqegGpHvlRz9sP5rhJEdn/8kGCrhSp8aYJPJ50mhg4Ih+LHURDEwLUOfu2uF5 yMZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773207004; x=1773811804; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=yMiEC4s5Zy2ROMM8JYQnh8H/Wz1M/LTwsc1zpfGD7ik=; b=jfc38Amc50siJR/hno3oTiYUOjMH2xfkKmnhzU1fvZtNzjIGWSnuNBU0bcO7OUqzAS lX85UbvxhWqtchLOQ2BW6xUwd0AuHw6M3ufx8V3txXTJsFpHM2oWHiX7jnsAgP/hJJlX k2ovgMYbcsbeDS/Hq1RVT+mgOAAGVgJrY3THfwoIIboxDJbLkZU1m5z2u7oLyCcBNUzV JW2DbhA14RC6ZoISFlpJjEwzGRwboAtGZQnaBEHDHl0eRYOMJilBKWlHGBPRMwXcSjmI p7az81s0gOx40MnxwugerAjCs5XipMOzeHDp4VHnhLVp8n4gRjF5AgsKzm9wv0LAAfVa pG+g== X-Gm-Message-State: AOJu0YxuetTF1xLRQnx3q1kl+PS/U9gmvmsWSHq572Kj5XDM17gCHxWg N6vtLMSCvLne4cKuFgKj3WaUJ84r3YBlpxvXMH5hSTecTRneYgAVrOFwADqMPVKOSZB3i6XD7pP PkNxVn7l3QDyBmPt8QBH2OEu62f0/O1A= X-Gm-Gg: ATEYQzxRZt9mVDRu+nP6oysAi1nf2a7N+0GaJM9fW+To0ymQJFjayefqWvpVi+ughug /Vb/pIOiaIl8neGsGekETaf36073gGbnFYNzrPLzs0oJFt2mKMIErZHreAauVlIxnt9O1CvW6uJ NDGN/NkMDL4oEN1hYzN2mbqgwY8u7UM47xWE8lv+KLWoPluNcR66HTN0YyhNpFqZluNG8rueqk9 EnHWFu5uSMoKyCDO/+GOfJ0k4VaWPYa6sQpXWyAfW9epn1F0qIwOq2tUAm+tlWQZwlLbcTVlyse N851Rzk= X-Received: by 2002:a05:6820:4b98:b0:679:95da:975f with SMTP id 006d021491bc7-67bc88aee39mr1013578eaf.27.1773207004029; Tue, 10 Mar 2026 22:30:04 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:6802:4895:b0:622:2a68:74f6 with HTTP; Tue, 10 Mar 2026 22:30:03 -0700 (PDT) In-Reply-To: <10df46d9.7dc2.19cd740a640.Coremail.jiye_sw@126.com> References: <10df46d9.7dc2.19cd740a640.Coremail.jiye_sw@126.com> From: "David G. Johnston" Date: Tue, 10 Mar 2026 22:30:03 -0700 X-Gm-Features: AaiRm53yG7-03LOIrSLJEgfr8UcHxdV1dAyzXu7cwgRmeAiM4MxfjrJ3ON7i2BU Message-ID: Subject: Re: FDW connection drops with "Connection timed out" during async append query due to TCP receive buffer filling up To: jiye Cc: "pgsql-bugs@lists.postgresql.org" Content-Type: multipart/alternative; boundary="00000000000096a868064cb8edbf" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000096a868064cb8edbf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tuesday, March 10, 2026, jiye wrote: > > This is a minimal working example. In practice, if the local table scan > takes too long and the foreign table has sufficiently wide rows, this iss= ue > may reproduce. > In my understanding, when performing a local sequential scan, the > PostgreSQL backend fetches data from the local plan without fetching any > data from the FDW. As a result, the TCP receive buffer may become full, > causing the FDW connection to be disconnected. > I believe this is a minor issue. How can I resolve this problem? > Do not establish a timeout that the execution of the query cannot beat. Or, I think, at least ensure the non-async portion of the query can produce a row within the allotted time so the async node is polled within the timeout. IIUC, the general loop flow is: begin append, begin async, poll async, poll non-async, poll async, poll non-async, etc=E2=80=A6. There will= usually be some lag between async polls. The tcp timeout has to be large enough to accommodate your reality. No different than if you used a statement timeout. I don=E2=80=99t actually know whether or if =E2=80=9Cbuffer filling up=E2= =80=9D is accurate or relevant here. It doesn=E2=80=99t seem that way. You haven=E2=80=99t demo= nstrated that scenario here, just a timeout being reached. https://github.com/postgres/postgres/blob/82467f627bd478569de04f4a3f1993098= e80c812/src/backend/executor/nodeAppend.c#L342 And since the main design point of async is that any of them may be polled at any time it is necessary for all such scans to be initialized before any polling begins. Starting the clock on all of them. If you don=E2=80=99t want a connection timeout to happen do not set one. T= hat=E2=80=99s the resolution here so far as I can tell. David J. --00000000000096a868064cb8edbf Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tuesday, March 10, 2026, jiye <jiy= e_sw@126.com> wrote:
This is a minimal working example. In practice,= if the local table scan takes too long and the foreign table has sufficien= tly wide rows, this issue may reproduce.
In my understanding, when p= erforming a local sequential scan, the PostgreSQL backend fetches data from= the local plan without fetching any data from the FDW. As a result, the TC= P receive buffer may become full, causing the FDW connection to be disconne= cted.
I believe this is a minor i= ssue. How can I resolve this problem?

Do not establish a timeout that the execution of the query cannot be= at.=C2=A0 Or, I think, at least ensure the non-async portion of the query c= an produce a row within the allotted time so the async node is polled withi= n the timeout.=C2=A0 IIUC, the general loop flow is: =C2=A0begin append, be= gin async, poll async, poll non-async, poll async, poll non-async, etc=E2= =80=A6. There will usually be some lag between async polls.=C2=A0 The tcp t= imeout has to be large enough to accommodate your reality.=C2=A0 No differe= nt than if you used a statement timeout.

I don=E2= =80=99t actually know whether or if =E2=80=9Cbuffer filling up=E2=80=9D is = accurate or relevant here.=C2=A0 It doesn=E2=80=99t seem that way.=C2=A0 Yo= u haven=E2=80=99t demonstrated that scenario here, just a timeout being rea= ched.

=

And since the main design point of async is that any of= them may be polled at any time it is necessary for all such scans to be in= itialized before any polling begins.=C2=A0 Starting the clock on all of the= m.

If you don=E2=80=99t want a connection timeout = to happen do not set one.=C2=A0 That=E2=80=99s the resolution here so far a= s I can tell.

David J.

--00000000000096a868064cb8edbf--