Fix missing initialization of delayChkptEnd
Fix missing initialization of delayChkptEnd
Hi, all
I got a coredump when testing with the REL_14_STABLE branch, which is as below:
I noticed that in commit 10520f4346876aad4941797c2255a21bdac74739, int delayChkpt has been changed back to bool delayChkpt + bool delayChkptEnd. However, the initialization to delayChkptEnd is missed in function InitProcess. When autovacuum_proc1 is in RelationTruncate, the delayChkptEnd will be set as true. If autovacuum_proc1 receives a cancel signal and handles it at this time, autovacuum_proc1 will exit without reseting delayChkptEnd in its error handling process. After that, if autovacuum_proc2 reuses this PGPROC structure, the above error will occur.
I add a patch to fix this bug in the attachment, hope you can check it.
Thanks & Best Regard
回复:Fix missing initialization of delayChkptEnd
Hi, all. I updated the patch for this bugfix, the previous one missed the modification of function InitAuxiliaryProcess, please check the new patch.
Thanks & Best Regard
------------------------------------------------------------------发件人:蔡梦娟(玊于) <mengjuan.cmj@alibaba-inc.com>发送时间:2023年6月5日(星期一) 19:44收件人:pgsql-hackers <pgsql-hackers@lists.postgresql.org>抄 送:robertmhaas <robertmhaas@gmail.com>主 题:Fix missing initialization of delayChkptEndHi, allI got a coredump when testing with the REL_14_STABLE branch, which is as below:I noticed that in commit 10520f4346876aad4941797c2255a21bdac74739, int delayChkpt has been changed back to bool delayChkpt + bool delayChkptEnd. However, the initialization to delayChkptEnd is missed in function InitProcess. When autovacuum_proc1 is in RelationTruncate, the delayChkptEnd will be set as true. If autovacuum_proc1 receives a cancel signal and handles it at this time, autovacuum_proc1 will exit without reseting delayChkptEnd in its error handling process. After that, if autovacuum_proc2 reuses this PGPROC structure, the above error will occur.I add a patch to fix this bug in the attachment, hope you can check it.Thanks & Best Regard
Re: 回复:Fix missing initialization of delayChkptEnd
От:
Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Дата:
Good catch! At Tue, 06 Jun 2023 00:39:47 +0800, "蔡梦娟(玊于)" wrote in > Hi, all. I updated the patch for this bugfix, the previous one > missed the modification of function InitAuxiliaryProcess, please > check the new patch. After a quick check through the 14 tree, then compaing with the corresponding parts of 15, it hit me that ProcArrayClearTransaction() needs an assertion on the variable. Other than that, the patch looks good to me. regards. -- Kyotaro Horiguchi NTT Open Source Software Center
Re: 回复:Fix missing initialization of delayChkptEnd
On Tue, Jun 06, 2023 at 03:13:14PM +0900, Kyotaro Horiguchi wrote: > After a quick check through the 14 tree, then compaing with the > corresponding parts of 15, it hit me that ProcArrayClearTransaction() > needs an assertion on the variable. Other than that, the patch looks > good to me. Yeah, it feels wrong to check only after delayChkpt in this code path. I'll look at that tomorrow. -- Michael
回复:回复:Fix missing initialization of delayChkptEnd
In my new patch for pg14, I add the assertion on delayChkptEnd in ProcArrayClearTransaction, and also add patches for release branch from 10 to 13, please check.
Thanks & Best Regard
------------------------------------------------------------------发件人:Kyotaro Horiguchi <horikyota.ntt@gmail.com>发送时间:2023年6月6日(星期二) 14:13收件人:蔡梦娟(玊于) <mengjuan.cmj@alibaba-inc.com>抄 送:pgsql-hackers <pgsql-hackers@lists.postgresql.org>; robertmhaas <robertmhaas@gmail.com>主 题:Re: 回复:Fix missing initialization of delayChkptEndGood catch!
At Tue, 06 Jun 2023 00:39:47 +0800, "蔡梦娟(玊于)" <mengjuan.cmj@alibaba-inc.com> wrote in
> Hi, all. I updated the patch for this bugfix, the previous one
> missed the modification of function InitAuxiliaryProcess, please
> check the new patch.
After a quick check through the 14 tree, then compaing with the
corresponding parts of 15, it hit me that ProcArrayClearTransaction()
needs an assertion on the variable. Other than that, the patch looks
good to me.
regards.
--
Kyotaro Horiguchi
NTT Open Source Software Center
Re: 回复:回复:Fix missing initialization of delayChkptEnd
On Wed, Jun 07, 2023 at 10:25:25AM +0800, 蔡梦娟(玊于) wrote: > In my new patch for pg14, I add the assertion on delayChkptEnd in > ProcArrayClearTransaction, and also add patches for release branch > from 10 to 13, please check. Thanks for the patches. I finally got back to that, double-checked all the spots where these flags are used on all the branches, and that seems right to me. So applied across 11~14. -- Michael