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.96) (envelope-from ) id 1vv0Vb-00GeK9-25 for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Feb 2026 22:03:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vv0Va-003eiD-1M for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Feb 2026 22:03:58 +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.96) (envelope-from ) id 1vv0Va-003ehz-0R for pgsql-hackers@lists.postgresql.org; Tue, 24 Feb 2026 22:03:58 +0000 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vv0VW-000000011PS-2FAQ for pgsql-hackers@lists.postgresql.org; Tue, 24 Feb 2026 22:03:57 +0000 Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-3585ec417f6so92643a91.1 for ; Tue, 24 Feb 2026 14:03:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771970635; x=1772575435; darn=lists.postgresql.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=sQbNtlNykRcsVSxbkXeZpixrGRYfNO1ht+kqgxwjWjw=; b=UhQ6aBXL0yuFShMGtKfCaD8pReZlyFTSq0Ses/3I09OlfmWsxTAXACEu1Ahab+kfdo UwKUSLh6CQZBqPYS6jNKz8A4XjM50M2Pfavv0uyQrfHRzi0HxpTDS6snrEH26ZvNKOuW hNg/4xsTQUSJlzcDSmFsL0Ci6LNl+K8jdD3CTrOIjlghG5nrn8uUVNP0hoR9epOArD/M awfdsXW1YkKgD/SOjLdGgFoGZrPvWdQTEVqjGIaxntoqLaYVIMHZRmBRv6j79+vTALnC eImrz8b9YemrP8Mn5Pafw14VeZlanBhsHmzUk96zUzCnPQ3FMolzVtn31TW+3Og59s7O f6Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771970635; x=1772575435; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sQbNtlNykRcsVSxbkXeZpixrGRYfNO1ht+kqgxwjWjw=; b=Y5y/BsA1EQOhw3oYZNXJztFxVHUPWR2CX87g6gQKJa+Hys1juhljWE9ber8CuJaeTF uCcOZXj/Fm+K4tkV66nnMhBEiz2vt/nkVkgdVDT7a4aX2rSC6WHM09W2SHpFU4WQeBn8 D3TFfzefHGxK+dWn8Z1GDytJCwcEUQqhKAAB4M3EEPn8VgMRI2o2p1CtgRbLC56NdXEL S/CgyDFyX/ziqMK0utD0MtLgkPMIFjNuX9jhNta8am2cyP2Rx6jPKt13tnSsKbXU0sE1 ySRjiyyZU1BRb+VHpEQuPlDA7oUq4OKU36thIKg3JVXEJUNk/BoMZh9hgm7bUJUkUzbZ PKAw== X-Forwarded-Encrypted: i=1; AJvYcCWIgHMB0ahHFjBasEMkKwAyMyWhBYaWZ+WV8KMzt33x3E3OkWujR13S8o44YYEwfioEditMaxfJAjr/mRxm@lists.postgresql.org X-Gm-Message-State: AOJu0Yzn3nmjhfgerh6Y+0yobJI25PrEJ6cvh/AxORPv53w/kDux973E 7E0LT02db5olY8O3V1P1eLJVuFL2hTeuEWH9zNfLEaBNYmLaBm3XtWpB X-Gm-Gg: ATEYQzxS2cIp52UWDkFrZy01Grw7qvrCGnDb5RKNQPJUsVDOLsGGmW2wU2D4vuVcExb gMz9IoiaYJSkOcHX5FkmkE2b1HmacgeAeWUg/KJ8tWAcduIX3m/yoqU7+ZtIuBI9OWOG6p1HavV Mih23yTOBxAgwOrtiYgYJUSAPscQvo6gXh/65cFB3Tj2R4DiafwBPvvm7vPojK298nojNnOXJpO bjKKkXgz+uVycbBmtm+4nmwOsCQUwR941+dDzwy0VX/icEKqxfGggB+G9aG6oMZzZirHHwfSxXc +9gOEk3OsR+4+8zK/z8Wo71uXqRLFWVfruCO19KfOPajNFpgTERfoovQWtaXLMG/9HRtwmhuER0 OMkEh29nGGf1uho4WTtEhanYc+era9Yh9Few6xm+1UdnNXCFj3EZNouLcY1g3Fd4LThbWAFJot/ A0rYNF+QnKjVUxKK3SIm52fDrE1IaTug7AURcxmaWQlA== X-Received: by 2002:a17:90b:4a51:b0:356:24c8:2291 with SMTP id 98e67ed59e1d1-359008bd1e4mr1125986a91.0.1771970634658; Tue, 24 Feb 2026 14:03:54 -0800 (PST) Received: from smtpclient.apple ([45.32.121.103]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-359034bbfd4sm736106a91.10.2026.02.24.14.03.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Feb 2026 14:03:53 -0800 (PST) From: Chao Li Message-Id: <2058F900-0706-4B46-A398-54FDABFD29F7@gmail.com> Content-Type: multipart/mixed; boundary="Apple-Mail=_3EB901C8-48F2-4007-A479-52C50B787DA9" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.300.41.1.7\)) Subject: Re: Fix bug of clearing of waitStart in ProcWakeup() Date: Wed, 25 Feb 2026 06:03:14 +0800 In-Reply-To: Cc: ji xu , PostgreSQL Hackers To: Fujii Masao References: <537BD852-EC61-4D25-AB55-BE8BE46D07D7@gmail.com> X-Mailer: Apple Mail (2.3864.300.41.1.7) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_3EB901C8-48F2-4007-A479-52C50B787DA9 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Feb 24, 2026, at 23:41, Fujii Masao wrote: >=20 > On Tue, Feb 24, 2026 at 4:31=E2=80=AFPM ji xu = wrote: >>=20 >>=20 >> Chao Li =E4=BA=8E2026=E5=B9=B42=E6=9C=8824=E6=97= =A5=E5=91=A8=E4=BA=8C 14:29=E5=86=99=E9=81=93=EF=BC=9A >>>=20 >>> Since this function is clearly operating on the parameter proc, the = only statement that touches MyProc looks suspicious. It should reset = proc->waitStart, not MyProc->waitStart. >>>=20 >>> As written, it will incorrectly clear the caller=E2=80=99s waitStart = instead of the awakened backend=E2=80=99s, potentially leaving a stale = waitStart value in the target PGPROC. >=20 > Thanks for the report! >=20 I just realized that I forgot to attach the patch file. Anyway, that=E2=80= =99s just a one-line change. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/ --Apple-Mail=_3EB901C8-48F2-4007-A479-52C50B787DA9 Content-Disposition: attachment; filename=v1-0001-Fix-bug-of-clearing-of-waitStart-in-ProcWakeup.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="v1-0001-Fix-bug-of-clearing-of-waitStart-in-ProcWakeup.patch" Content-Transfer-Encoding: quoted-printable =46rom=205a741a41f675a8cff11cdbb20c819e4853ed1499=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20"Chao=20Li=20(Evan)"=20=0A= Date:=20Tue,=2024=20Feb=202026=2014:11:24=20+0800=0ASubject:=20[PATCH=20= v1]=20Fix=20bug=20of=20clearing=20of=20waitStart=20in=20ProcWakeup()=0A=0A= ProcWakeup()=20incorrectly=20resets=20MyProc->waitStart=20instead=20of=20= the=0AwaitStart=20field=20of=20the=20process=20being=20awakened.=0A=0A= Fix=20by=20resetting=20proc->waitStart,=20which=20corresponds=20to=20the=20= PGPROC=0Abeing=20removed=20from=20the=20wait=20queue.=0A=0AThis=20looks=20= like=20oversight=20of=2046d6e5f.=0A=0AAuthor:=20Chao=20Li=20= =0AReviewed-by:=0ADiscussion:=20https://postgr.es/m/=0A= ---=0A=20src/backend/storage/lmgr/proc.c=20|=202=20+-=0A=201=20file=20= changed,=201=20insertion(+),=201=20deletion(-)=0A=0Adiff=20--git=20= a/src/backend/storage/lmgr/proc.c=20b/src/backend/storage/lmgr/proc.c=0A= index=20e2f34075d39..771b006b522=20100644=0A---=20= a/src/backend/storage/lmgr/proc.c=0A+++=20= b/src/backend/storage/lmgr/proc.c=0A@@=20-1715,7=20+1715,7=20@@=20= ProcWakeup(PGPROC=20*proc,=20ProcWaitStatus=20waitStatus)=0A=20=09= proc->waitLock=20=3D=20NULL;=0A=20=09proc->waitProcLock=20=3D=20NULL;=0A=20= =09proc->waitStatus=20=3D=20waitStatus;=0A-=09= pg_atomic_write_u64(&MyProc->waitStart,=200);=0A+=09= pg_atomic_write_u64(&proc->waitStart,=200);=0A=20=0A=20=09/*=20And=20= awaken=20it=20*/=0A=20=09SetLatch(&proc->procLatch);=0A--=20=0A2.50.1=20= (Apple=20Git-155)=0A=0A= --Apple-Mail=_3EB901C8-48F2-4007-A479-52C50B787DA9--