Re: Transaction timeout

From: "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>
To: Li Japin <japinli(at)hotmail(dot)com>
Cc: Junwang Zhao <zhjwpku(at)gmail(dot)com>, 邱宇航 <iamqyh(at)gmail(dot)com>, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, Andrey Borodin <amborodin86(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Nikolay Samokhvalov <samokhvalov(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Transaction timeout
Date: 2023-12-23 17:14:35
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> On 22 Dec 2023, at 10:39, Japin Li <japinli(at)hotmail(dot)com> wrote:
> I try to split the test for transaction timeout, and all passed on my CI [1].

I like the refactoring you did in timeout.spec. I thought it is impossible, because permutations would try to reinitialize FATALed sessions. But, obviously, tests work the way you refactored it.
However I don't think ignoring test failures on Windows without understanding root cause is a good idea.
Let's get back to v13 version of tests, understand why it failed, apply your test refactorings afterwards. BTW are you sure that v14 refactorings are functional equivalent of v13 tests?

To go with this plan I attach slightly modified version of v13 tests in v16 patchset. The only change is timing in "sleep_there" step. I suspect that failure was induced by more coarse timer granularity on Windows. Tests were giving only 9 milliseconds for a timeout to entirely wipe away backend from pg_stat_activity. This saves testing time, but might induce false positive test flaps. So I've raised wait times to 100ms. This seems too much, but I do not have other ideas how to ensure tests stability. Maybe 50ms would be enough, I do not know. Isolation runs ~50 seconds now. I'm tempted to say that 200ms for timeouts worth it.

As to 2nd step "Try to enable transaction_timeout during transaction", I think this makes sense. But if we are doing so, shouldn't we also allow to enable idle_in_transaction timeout in a same manner? Currently we only allow to disable other timeouts... Also, if we are already in transaction, shouldn't we also subtract current transaction span from timeout?
I think making this functionality as another step of the patchset was a good idea.


Best regards, Andrey Borodin.

Attachment Content-Type Size
v17-0001-Introduce-transaction_timeout.patch application/octet-stream 19.8 KB
v17-0002-Try-to-enable-transaction_timeout-before-next-co.patch application/octet-stream 1.4 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2023-12-23 17:31:16 Re: authentication/t/ trashes ~/.psql_history
Previous Message Tom Lane 2023-12-23 16:52:56 Re: authentication/t/ trashes ~/.psql_history