Re: Infinite loop in pgbench when running COPY command
От | Michael Paquier |
---|---|
Тема | Re: Infinite loop in pgbench when running COPY command |
Дата | |
Msg-id | aN43URxzMCI2B-I-@paquier.xyz обсуждение исходный текст |
Ответ на | Infinite loop in pgbench when running COPY command (Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>) |
Ответы |
Re: Infinite loop in pgbench when running COPY command
|
Список | pgsql-hackers |
On Wed, Oct 01, 2025 at 11:25:00AM +0200, Anthonin Bonnefoy wrote: > 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. Fun. It seems like nobody has ever tested this scenario, even for a COPY TO. Why did you try that? Did you have a benchmark scenario in mind? + case PGRES_COPY_IN: + case PGRES_COPY_OUT: + case PGRES_COPY_BOTH: + pg_log_error("COPY is not supported in pgbench, aborting"); + + /* + * We need to exit copy state. Otherwise, PQgetResult will + * always return an empty PGresult from getCopyResult, leading + * to an infinite loop during error cleanup + */ + PQendcopy(st->con); + goto error; That sounds like a good choice to just fail for the time being, all these result types don't seem to work (quickly checked). If somebody wants to support this case, we could always sort it out, but I am ready to bet that the odds are in the favor of doing nothing. -- Michael
Вложения
В списке pgsql-hackers по дате отправления: