Re: BUG: ReadStream look-ahead exhausts local buffers when effective_io_concurrency>=64

From: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
To: Feike Steenbergen <feikesteenbergen(at)gmail(dot)com>
Cc: Eduard Stepanov <crtxcz(at)gmail(dot)com>, Induja Sreekanthan <indujas(at)google(dot)com>, pgsql-hackers(at)postgresql(dot)org, Simhachala Sasikanth Gottapu <simhachala(at)google(dot)com>, Vishal Bagga <vishalbagga(at)google(dot)com>, Madhukar <madhukarprasad(at)google(dot)com>, Shihao Zhong <shihaozhong(at)google(dot)com>, Yi Ding <yidin(at)google(dot)com>, Hardik Singh Negi <hardiksnegi(at)google(dot)com>
Subject: Re: BUG: ReadStream look-ahead exhausts local buffers when effective_io_concurrency>=64
Date: 2026-07-23 09:59:05
Message-ID: CABPTF7XzivpmOL=ennd0og_ute8DQ-3L_UJV3J8wOfkZEBF67w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jul 23, 2026 at 5:17 PM Feike Steenbergen
<feikesteenbergen(at)gmail(dot)com> wrote:
>
>
>
> On Fri, 3 Jul 2026 at 05:54, Xuneng Zhou <xunengzhou(at)gmail(dot)com> wrote:
>
> > > On Wed, 6 May 2026 at 14:24, Feike Steenbergen <feikesteenbergen(at)gmail(dot)com> wrote:
> > > > For now, the problem disappears again when switching to io_method='worker'
> > >
> > > I spoke too soon it seems. It happens less frequently, but we do still have the issue even with io_method='worker'.
> > > Reverting to io_method='sync' as I would expect that will solve the issue.
> >
> > Interestingly, I wonder why this variance would occur in production.
> > This is the more interesting part of this thread. I did some
> > investigation & experiment, pg 19 passed the reproducer even if
> > da6874635db is removed. A series of improvements made in April may
> > contribute to this. Will return soon to share the findings..
>
> Indeed, we see the problem occur at *all* settings of io_method. As it is slightly unpredictable,
> a retry of a transaction may succeed afterwards, so our production application is mostly
> fine. We did observe these errors right after upgrading to pg19, then we didn't observe the error
> for a full 3 weeks, but now we observe the error dozens of times every hour.
>
> Our application has a bit of a cadence though, it only does its work 5/6 hours, and the error
> is only showing when the application is actually doing work.

That seems strange. Can you share some failure logs and describe the
workload a bit more? There are possible workloads that keep squeezing
out the temp buffers. It would also be helpful to do some quick
diagnoses like:

1) ALTER SYSTEM SET backtrace_functions = 'GetLocalVictimBuffer';
SELECT pg_reload_conf();

2) SELECT version();

3) Settings: temp_buffers, effective_io_concurrency, io_combine_limit

> > 2) Three engines, two pools
> >
> > To be continued...
>
> On our end, we're trying to reduce connections (batch more, queue work outside the db more),
> however, it would be great if this problem can be fully identified and resolved in pg
> itself.

If this same issue/failure persists, I'm afraid this move would not
mitigate it or could be counterproductive since the temp-pressure per
backend is bigger. It might be more helpful to up the temp_buffers &
down the effective_io_concurrency if the arithmetic applies here.

--
Regards,
Xuneng Zhou
HighGo Software Co., Ltd.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Rafia Sabih 2026-07-23 10:03:38 Re: Bypassing cursors in postgres_fdw to enable parallel plans
Previous Message Fujii Masao 2026-07-23 09:44:06 Re: Allow pg_read_all_stats to see database size in \l+