Hi Jingtang,
There is a similar case on the read side. In psql:
CREATE TABLE tt_copy_wait (v text);
BEGIN;
SET LOCAL transaction_timeout = '2s';
COPY tt_copy_wait FROM STDIN;
Leave COPY waiting for input for more than 2s. In my run,
pg_stat_activity still showed active ClientRead.
Entering \. then produced:
FATAL: terminating connection due to transaction timeout
During COPY input, DoingCommandRead is false. The read-wait path in
ProcessClientReadInterrupt() then handles ProcDiePending, but not
TransactionTimeoutPending. Could the fix cover this path too?
I've posted draft fixes for other transaction_timeout issues [0], but
this ClientRead case is independent. Just linking these threads together.
Thank you!
Best regards, Andrey Borodin.
[0] https://postgr.es/m/87676E9A-DCA9-46AE-9214-5C374D5832F3%40yandex-team.ru