Infinite loop in pgbench when running COPY command

From: Anthonin Bonnefoy <anthonin(dot)bonnefoy(at)datadoghq(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Infinite loop in pgbench when running COPY command
Date: 2025-10-01 09:25:00
Message-ID: CAO6_XqpHyF2m73ifV5a=5jhXxH2chk=XrgefY+eWWPe2Eft3=A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Currently, pgbench processes a copy response as unexpected and will
move to the error loop. However, PQgetResult will alway return an
empty result when there's no async result through getCopyResult,
leading to an infinite loop in the error handling as res will never be
NULL.

This patch forcefully exits the copy state with PQendcopy before
moving to the error handler, avoiding the infinite loop.

Regards,
Anthonin Bonnefoy

Attachment Content-Type Size
v01-0001-Exit-copy-state-in-pgbench-to-avoid-infinite-loo.patch application/octet-stream 2.1 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message jian he 2025-10-01 09:28:24 Re: CREATE TABLE LIKE INCLUDING TRIGGERS
Previous Message torikoshia 2025-10-01 09:11:23 Re: RFC: Logging plan of the running query