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 1rGgTQ-00GZe5-Nc for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Dec 2023 14:26:01 +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 1rGgTP-007Sho-Ca for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Dec 2023 14:25:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rGgTO-007ShZ-Ip for pgsql-hackers@lists.postgresql.org; Fri, 22 Dec 2023 14:25:59 +0000 Received: from mail-me3aus01olkn2178.outbound.protection.outlook.com ([40.92.63.178] helo=AUS01-ME3-obe.outbound.protection.outlook.com) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rGgTL-00DMdr-Gj for pgsql-hackers@lists.postgresql.org; Fri, 22 Dec 2023 14:25:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DbX2SsloV4gbQugREcjGQi+njLszh2ICLNsepviPJAcwr543/A1+OT2u5c42YI/jouE658PoD8H4cgzekxzSSIWPoX4dw1PTzO7cVc1IwkeBrukqgin+y3GECPSTc6kLsNFMP7m7OJsr74XaP5iyPXOhjqYWDHOzRGyyZuCQSeIWgTZvZ6kQ0qVCbG7CS88AY7HCG4TmKtDVVCkczHiJ9KHcEUVVSUgnMj2ek73k1Cjc6T20udtLrnOR4klL8JduqvqjD5AezwnCVI0PpgoFog8u8E8/MkG8dHkRIRcGlhBgN4t0sLl1AaOnSpFp3Evii8n5smUjkKEDk0XzaoW2hA== 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=WGn/XTkACvTvxw5O/AoMYjJ3On6cBXNvUSNPII3Ak1w=; b=ka2bJyGNwEHJGLUvSvFSfopMlpvJSyNptUy35kumXA8Rm3QXCwZ33VA5MenTOEYC8pgGTxLYMVdxjGin6SF8/xBJUwNciXNbVx7QBAopOm1x/SRCPcj4PYsIKI/sS5HtNPozteqvsPyHk5wL9E/rdwuD6iX6aVkTnDQRpkbXvvNsP/797qLyL14KWJ3QGdIhrH4jhoRtFi2S2SYhxy6qq/v57YN26UbprmUO9e7e5w69S5/85h5apSbrMLFu9Qg3pIgfxInfAI0QQy2wpvOpreS0+rLoywGmbrDrrjTz3c8PvzLXe9ePJ+3sCIwV+yXNmDqVAdpcnOLqqiuPAHuplQ== 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=WGn/XTkACvTvxw5O/AoMYjJ3On6cBXNvUSNPII3Ak1w=; b=sfJWJYPHbi1oAVOCNJi6jI0kjP7QLn2z1+mCMPqSE45KtZIcTnwg/siN1nLWQ7fqWOsO1RTcYAEI0rCeNKZsjPBaDTTryqVydTqhi5HiH9PHfGWpsILQiySR1YvDRODTdskyEj8NUllJWdE68lAvDHi2Gd0498p+M/rTKIhYILdxxMk9K7eO1twpA9C8B3qjl0SfUSgC4zCjmcyO29YJgju3uyNajmQFfcnbx4VrSdC0LtCCFPkYDrCDBHUOCp+2KoCltKLdQ/tG5ULcfvOmGpszvQoFgcPhCiqWCfjKtn4tIE2JOQDekT087Zc6I3Bk+lbIhoCvk4p9UMu58ckSEQ== Received: from ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:147::21) by SY5P282MB4489.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:26d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.21; Fri, 22 Dec 2023 14:25:47 +0000 Received: from ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM ([fe80::3a9:3f12:f758:103f]) by ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM ([fe80::3a9:3f12:f758:103f%3]) with mapi id 15.20.7113.019; Fri, 22 Dec 2023 14:25:47 +0000 References: <09C069FE-99D2-4298-B1A5-01058DE6CBF7@yandex-team.ru> <60ACCBF9-5BAD-457E-9EE9-CEC95A352EB0@gmail.com> <145F4741-008A-41BF-AE06-1BE1435DFB1A@yandex-team.ru> <76472EBA-077B-4F6D-B84D-F0917A31CEDD@yandex-team.ru> <7B300616-70CE-4CCB-A014-13BC0AF814CA@yandex-team.ru> <459C55FE-F49A-4D9A-8C98-F4AEB47B68D7@yandex-team.ru> User-agent: mu4e 1.4.15; emacs 28.1 From: Japin Li To: Junwang Zhao Cc: "Andrey M. Borodin" , =?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: Date: Fri, 22 Dec 2023 22:25:37 +0800 Message-ID: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-TMN: [Ja85Skqo1h/h/eR42szrPuhJzW0mQrBG] X-ClientProxiedBy: BYAPR06CA0013.namprd06.prod.outlook.com (2603:10b6:a03:d4::26) To ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:147::21) X-Microsoft-Original-Message-ID: <86h6kagvq6.fsf@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: ME3P282MB3166:EE_|SY5P282MB4489:EE_ X-MS-Office365-Filtering-Correlation-Id: a758a194-9592-48fd-13fb-08dc02f9e3e8 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CQ8ltA3Hr8ci6xZmfH3RbLvHJD0jtwdwU0XS2JG4ycdVUnOveKXfGZAghGI5yIx8Yk1TkBTTrgxH8HZp8zu7/+xT/tZXk/e+igVgS0JABRvUCDN0GfQ5LsEQvgxzPxacn0VGGav0fZcChQ827B6Jw9pXGZqjxWAuKrsXElD06QC7VxNDvRa+Sixm8LSjFz7EkrPzTLm5Mc85OmFpLz7ApILYZ9L9zbiSjuBeFQ+SRRl3ETRJtb4754KO4Zl9NNE3tCpJNxkEaNhbOWTBRFdEs2iu0cWI6CiCwaBdjOpeEInzHDHc7TT9q2BGajQorlaXCcXWPiRkxC1si6O5ne70PZwKpjpomOXDhMV79Zs60ZBP1kNdi0dAgkpPnYvpB9BISQvrgRu8aTECEVKW7Bou1mFV1JRRSXcYfZC1oOVBEBR3t+73SbqT9wZ4KS7F9RXMJW98LfTHguMgB+poWicYzFSGPVGjamuw4RR6vLSURlgI2RYdoRf5nlNzk0UbyNib0RWYCce4QNLCOf5u157t7UcZo2b4j+Gft49gP72ZEGbXjyT6Nq0vf3dYPaWnif4qAgRMrLJ26O+f12D4THLNxyjlPG/dBL0bLdIRhS5Q7p4= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MStVMjRhZ2l5K1Brc204OS9HbzRQU3hPWE1kUmVaanpsVWRhc0tKSTdJL2FJ?= =?utf-8?B?NHV1SFgxaVRTVTFNVVZ1MEpqOGFmbjZQV2pUQlFmci9XbGxLNFlFNjR1VGc4?= =?utf-8?B?QTNqSzR0TzFlMFNqYU8wODI3d0xTbnd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aXVnTmlicHVmTkM0R3dISmRlR0IrbXNqVFAx?= =?utf-8?B?MldKMkU3V1F4a0pOdUh3TDFXK2NvSEk2TmI3QWRPZERsMGVkL0x3bkdoU1Mz?= =?utf-8?B?elBPdE1LMFFnVWp3S1g3eW1ycHBRUjRkcFB5N3lZTTgxVzNuUmF0L3dqblZF?= =?utf-8?B?RHJQYys1blRMaXhiQVlFeHFIZDVvVW1OUjRZR1NFY1hHWnB6UkhVNUdmU3h3?= =?utf-8?B?RUxxM0lrT0hZODdnWGZIdVdXSVNVcTFYTVZLVU5GdWdnSGNYR0lzOWphOFcx?= =?utf-8?B?MUxxMkd6cC8wMnRaWVBaNUg2aUdjVHliQWZSTzdnRTJTZnVNWmcrcStCaVFn?= =?utf-8?B?YkRBSkhvN0VEMUlySXM2Y2ErdUZEMXVzdzJ1K2kyWnZvcmltRVpEWDBuQ3N6?= =?utf-8?B?TUNGY2J4TE1xaFEzK25sdTU5RW85VlZuVW5JcklHUTlFaGtGSXQzVlQxWjQx?= =?utf-8?B?ay92WlVIa1h2Vm1LMW5yaG4zeEd6T2EwUks0TzhLcjRaYlNxVTQ1blRmNGpw?= =?utf-8?B?d1puY1loQWJnZlZSSENEaGhzWmJhdkVLQ3UzVFNoUmVzbTRWNE85VlpvQng5?= =?utf-8?B?ZG96NlV2d0VCeHhqTURoNEFFNVpXSnc9PQ==?= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-746f3.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: a758a194-9592-48fd-13fb-08dc02f9e3e8 X-MS-Exchange-CrossTenant-AuthSource: ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Dec 2023 14:25:47.7252 (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: SY5P282MB4489 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 22 Dec 2023 at 20:29, Junwang Zhao wrote: > On Fri, Dec 22, 2023 at 1:39=E2=80=AFPM Japin Li wr= ote: >> >> >> On Tue, 19 Dec 2023 at 22:06, Japin Li wrote: >> > On Tue, 19 Dec 2023 at 18:27, Andrey M. Borodin = wrote: >> >>> On 19 Dec 2023, at 13:26, Andrey M. Borodin w= rote: >> >>> >> >>> I don=E2=80=99t have Windows machine, so I hope CF bot will pick thi= s. >> >> >> >> I used Github CI to produce version of tests that seems to be is stab= le on Windows. >> > >> > It still failed on Windows Server 2019 [1]. >> > >> > diff -w -U3 C:/cirrus/src/test/isolation/expected/timeouts.out C:/cirr= us/build/testrun/isolation/isolation/results/timeouts.out >> > --- C:/cirrus/src/test/isolation/expected/timeouts.out 2023-12-= 19 10:34:30.354721100 +0000 >> > +++ C:/cirrus/build/testrun/isolation/isolation/results/timeouts.out = 2023-12-19 10:38:25.877981600 +0000 >> > @@ -100,7 +100,7 @@ >> > step stt3_check_stt2: SELECT count(*) FROM pg_stat_activity WHERE app= lication_name =3D 'isolation/timeouts/stt2' >> > count >> > ----- >> > - 0 >> > + 1 >> > (1 row) >> > >> > step itt4_set: SET idle_in_transaction_session_timeout =3D '1ms'; SET= statement_timeout =3D '10s'; SET lock_timeout =3D '10s'; SET transaction_t= imeout =3D '10s'; >> > >> > [1] https://api.cirrus-ci.com/v1/artifact/task/4707530400595968/testru= n/build/testrun/isolation/isolation/regression.diffs >> >> Hi, >> >> I try to split the test for transaction timeout, and all passed on my CI= [1]. >> >> OTOH, I find if I set transaction_timeout in a transaction, it will not = take >> effect immediately. For example: >> >> [local]:2049802 postgres=3D# BEGIN; >> BEGIN >> [local]:2049802 postgres=3D*# SET transaction_timeout TO '1s'; > when this execute, TransactionTimeout is still 0, this command will > not set timeout >> SET >> [local]:2049802 postgres=3D*# SELECT relname FROM pg_class LIMIT 1; -- = wait 10s > when this command get execute, start_xact_command will enable the timer Thanks for your exaplantion, got it. >> relname >> -------------- >> pg_statistic >> (1 row) >> >> [local]:2049802 postgres=3D*# SELECT relname FROM pg_class LIMIT 1; >> FATAL: terminating connection due to transaction timeout >> server closed the connection unexpectedly >> This probably means the server terminated abnormally >> before or while processing the request. >> The connection to the server was lost. Attempting reset: Succeeded. >> >> It looks odd. Does this is expected? I'm not read all the threads, >> am I missing something? > > I think this is by design, if you debug statement_timeout, it's the same > behaviour, the timeout will be set for each command after the second > command was called, you just aren't aware of this. > I try to set idle_in_transaction_session_timeout after begin transaction, it changes immediately, so I think transaction_timeout should also be take immediately. > I doubt people will set this in a transaction. Maybe not, -- Regrads, Japin Li ChengDu WenWu Information Technology Co., Ltd.