Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rTNfT-002TFw-Bb for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Jan 2024 14:58:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rTNfS-00Gq8O-2p for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Jan 2024 14:58:54 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rTNfR-00Gq8A-7K for pgsql-hackers@lists.postgresql.org; Fri, 26 Jan 2024 14:58:53 +0000 Received: from mail-sy4aus01olkn2184.outbound.protection.outlook.com ([40.92.62.184] helo=AUS01-SY4-obe.outbound.protection.outlook.com) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rTNfN-003UN1-N9 for pgsql-hackers@postgresql.org; Fri, 26 Jan 2024 14:58:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OyWq/KWGCN8QrCtoa9WAynTjNSX17TG8tS299VIwDH21m0XKQpHm07scICa4TLlbkafGy8LcNUIQzbzqcMZj2GQgRoCALHFi+L53ToD56DMu/2oV4VmXINNFBHZVhZ3ck2vZRkaqXuI6IcVF3m7pBof2/qZLu3rF3dUoNkFOG3olde047ZjZ7OYZ5GlWUmX/gKHM771hh0VSuHx5F0XYwpcVb93GKKN/9Iy/oZ14le9UodJ7YPz5fYLX4ikQlbru1+SCkhmvK+9TUKsHues7KhrQeW/AHWVG1Vy3ZlBoQHmYMSC23ZgHHsDIwrcxgAe8hj4UmrsDOl1PJmw+wShisQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/UGdSNCoQqXOfu0VqTnc2wXUIXVN5mWCaV79yQ/4OLM=; b=FaVHWMrdDVNUJmZVUvwRhTYuv4GvzQifYdzwR7ROKlZxRlqeaNAo/PnozImDUdHH3vj24pDKQxiFsEhoBAyh+Q880Hp0EAKddgga0kdOzTrCFCs8RYTdDAvGQoyFd71dHOMg99xbLeQHQgzNwGRqtMRzbd67rYsNmVIglVnaPptg5N3ZMFw6Ly1b1hcJTzTfGtmDkJ0DrU4YxyQSsh4Zfob2YqOJCejAmVDok4uxVrWAm6woi4xnZ7mVDPnLmWl0p0DfTtqmkQ3QHC0OL1yFleOnDfbrCQYGDDcvMdA3/fVAOBXouczrMe1CzkAO+prSAkEBCLOdgDyU3hYe+wj6cQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/UGdSNCoQqXOfu0VqTnc2wXUIXVN5mWCaV79yQ/4OLM=; b=cO1cTs37jBTs5uoXWDFsFjmkFzXxhQVTq79sV5OHHe/AM1sRWW0R8xtHYbN2ESZ4K/CdQEozFt6V9iiHR1rW06DNuOluDatHEM4Deud15xng6QQBg7RzbK4o3k8jBpIsmxFEqKORWKkQZllUgwxz+BopAIGRGEGBEELj6Qh2oCWwp2WO2dgJRueuS0dJBKpd88zs1vxGX81WLTCvBF0u2Irn7vKncZG1iYNzOBw26plgoUz4E5PxkwpH/6y0YGgOJtLGlJy8Q4FtVglsRbA6QxxrmskWNfn1o3GSsqHykgSkbn5bq0zPPlR8ds/QQsphvF3TIyCrVqN7t3owz84K3A== Received: from ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:147::21) by ME3P282MB0867.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:82::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.28; Fri, 26 Jan 2024 14:58:42 +0000 Received: from ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM ([fe80::acd1:1c3a:47d3:276b]) by ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM ([fe80::acd1:1c3a:47d3:276b%5]) with mapi id 15.20.7228.028; Fri, 26 Jan 2024 14:58:42 +0000 References: <79905780-F316-4DD3-812E-654D460E381C@yandex-team.ru> <68965408-F5A3-459F-A84E-5F4F2C237A5B@yandex-team.ru> <03431609-49D0-445E-97F0-ACF6C526F3EB@yandex-team.ru> <59B505DD-1931-49A3-9716-2DD7A002CCC6@yandex-team.ru> <4C30F833-C0F2-4664-B0FF-192FD8AB2E2E@yandex-team.ru> User-agent: mu4e 1.4.15; emacs 28.1 From: Japin Li To: "Andrey M. Borodin" Cc: Peter Smith , Junwang Zhao , =?utf-8?B?6YKx5a6H6Iiq?= , Fujii Masao , Andrey Borodin , Andres Freund , Michael Paquier , Nikolay Samokhvalov , pgsql-hackers , "pgsql-hackers@lists.postgresql.org" Subject: Re: Transaction timeout In-reply-to: <4C30F833-C0F2-4664-B0FF-192FD8AB2E2E@yandex-team.ru> Date: Fri, 26 Jan 2024 22:58:34 +0800 Message-ID: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-TMN: [Pr9DUi3Oayz/Rww0VRSfl+1DpgoyKV5YRgIoIlfklPM=] X-ClientProxiedBy: TYWPR01CA0008.jpnprd01.prod.outlook.com (2603:1096:400:a9::13) To ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:147::21) X-Microsoft-Original-Message-ID: <87bk98dtut.fsf@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: ME3P282MB3166:EE_|ME3P282MB0867:EE_ X-MS-Office365-Filtering-Correlation-Id: 8b343e76-e129-4b02-785d-08dc1e7f48d7 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9Wb+6mpRMYEU9+zmQzzn6YVk8K6b8/54vpS1+N1RhumFShkmLFldxcye8NHwChQI+TvNCjpqoBriJcCn0SU63B0QhxvuXs3od2o9K6IIGP/F0ovE7cInvfrSdxtXqyUYNvj7FQvdqGKRXmrDey8I7TBTtqw8HWfbtHDAyTQp0OwvcWodY69fuK07dHsx9pvCZp8pj2EcxMwk5218EgTPlV47tyOQ2rfOflXZbFo212tY+vvx5CxF+f5LS1ufhmBTR/ARhpOaHnInl7rZpkGU4KB9kJqj6mfX/rSTexia4MA9xyBX+nbsvfQkDd358uS3H91/hMHIXoin2zR6n14tSRuilESLuxlFP4OawgFqfqQPsvtmxrEQznOjIb3SOCoN/vQ9+3nGDKPX979jDrc4cLPuQLSV6gK31gOVEKNGm8FsDFFGzr6g+l8Dhtg/k7lhHuHa4OnzotNAqvtVeS8GqkKEKAop4nk/ZfLbVMPnrBukeN4XQ3jZlnaae/BtVM4bpJ/wMj9LnvTZSkxHvEtAWci1IN9tNWV5iL1DP5+8c5f+XICu17yCrivOCJ7inYya X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?WUlTdEhIaWdQVDM0elhobHpmNnpKMXZrMmRxZkRoM09ncXR3aEZpZFByRGpm?= =?utf-8?B?OTFLNWZoYzVYdUU2MTdjbVZYeUM3TzVqOWtNRDA0SjBsRXBaMk95N1ppN2Vu?= =?utf-8?B?Tll6OXNWSDRBdzM1TkVaM29DOFNCMHcxNnlWa1RUVlBWaFEzMzVvS2RWY2o4?= =?ut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1Szk5UXJZNHFq?= =?utf-8?B?WjQwVysxWUVEdE5YN3I2MUV4ZnNKTndjY1dQQVFyRmxtdThPQUc2b1FJOVIr?= =?utf-8?B?NElrdlRUT0NCbks4cTA2dEJzV2czd0o1aFFjbFppN3pPRXBCd0tSZHIwQkxX?= =?utf-8?B?YzVxUmFQejZzcTkzVlZubmZWTk9OaGFUd1BqODZPYVhJNGdzWFQ1bFgvWkk4?= =?utf-8?B?Mm83d0theWFGUXM3dmZZNGNrcFhnS0lJd2xLS291RlhMUVdmcGRaNEJvdzg1?= =?utf-8?B?Ri9vWTI4Rzkvd1l6RWlIZFN6OWJIMDlhbSsyN2VUOVN6cnVSQVZtWDlYTUV4?= =?utf-8?B?M3d4QWgzVDBlcnM4OVJ4L0g0V1A1ajlkMEFnS1U4Z0VpcHl3M28xb0tFcHJH?= =?utf-8?B?bmlXYjh0NUxWTFE0UlNZeUJzb1RTbmd1MWF3amVIU2ROZmc3MFFHeGlBS29i?= =?utf-8?B?cXBqanVpdUQwMnVLcVZhNDVCMzJQRW5kUlVBTWVNK08vdUdGQlpyM25mTHZ1?= =?utf-8?B?OWRZVFM2WTliUjl3SFdVaXppcTdLc0JEcjdpU2ZjMW4xVWZVZWRKZUFoNjdj?= =?utf-8?B?SlNJRWJUckZZRGRFT2dlMlltNHZYSHc9PQ==?= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-746f3.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 8b343e76-e129-4b02-785d-08dc1e7f48d7 X-MS-Exchange-CrossTenant-AuthSource: ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2024 14:58:42.6770 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: ME3P282MB0867 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 26 Jan 2024 at 14:44, Andrey M. Borodin wrot= e: >> On 22 Jan 2024, at 11:23, Peter Smith wrote: >> >> Hi, This patch has a CF status of "Needs Review" [1], but it seems >> there was a CFbot test failure last time it was run [2]. Please have a >> look and post an updated version if necessary. > Thanks Peter! > Thanks for updating the patch. Here are some comments for v24. + + Terminate any session that spans longer than the specified amount = of + time in transaction. The limit applies both to explicit transactio= ns + (started with BEGIN) and to implicitly started + transaction corresponding to single statement. But this limit is n= ot + applied to prepared transactions. + If this value is specified without units, it is taken as milliseco= nds. + A value of zero (the default) disables the timeout. + The sentence "But this limit is not applied to prepared transactions" is re= dundant, since we have a paragraph to describe this later. + + + If transaction_timeout is shorter than + idle_in_transaction_session_timeout or statement_timeout + transaction_timeout will invalidate longer time= out. + + Since we are already try to disable the timeouts, should we try to disable them even if they are equal. + + + Prepared transactions are not subject for this timeout. + Maybe wrap this with is a good idea. > I=E2=80=99ve inspected CI fails and they were caused by two different pro= blems: > 1. It=E2=80=99s unsafe for isaoltion tester to await transaction_timeout = within a query. Usually it gets > FATAL: terminating connection due to transaction timeout > But if VM is a bit slow it can get occasional > PQconsumeInput failed: server closed the connection unexpectedly > So, currently all tests use =E2=80=9Cpassive waiting=E2=80=9D, in a sessi= on that will not timeout. > > 2. In some cases pg_sleep(0.1) were sleeping up to 200 ms. That was makin= g s7 and s8 fail, because they rely on this margin. I'm curious why this happened. > I=E2=80=99ve separated these tests into different test timeouts-long and = increased margin to 300ms. Now tests run horrible 2431 ms. Moreover I=E2=80= =99m afraid that on buildfarm we can have much randomly-slower machines so = this test might be excluded. > This test checks COMMIT AND CHAIN and flow of small queries (Nik=E2=80=99= s case). > > Also I=E2=80=99ve verified that every "enable_timeout_after(TRANSACTION_T= IMEOUT)=E2=80=9D and =E2=80=9Cdisable_timeout(TRANSACTION_TIMEOUT)=E2=80=9D= is necessary and found that case of aborting "idle in transaction (aborted= )=E2=80=9D is not covered by tests. I=E2=80=99m not sure we need a test for= this. I see there is a test about idle_in_transaction_timeout and transaction_tim= eout. Both of them only check the session, but don't check the reason, so we cann= ot distinguish the reason they are terminated. Right? > Japin, Junwang, what do you think? However, checking the reason on the timeout session may cause regression te= st failed (as you point in 1), I don't strongly insist on it. -- Best regards, Japin Li.