Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lwjZ9-0000D2-Az for pgsql-bugs@arkaria.postgresql.org; Fri, 25 Jun 2021 11:00:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lwjZ7-0006oz-G8 for pgsql-bugs@arkaria.postgresql.org; Fri, 25 Jun 2021 11:00:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lwjZ7-0006oq-7V for pgsql-bugs@lists.postgresql.org; Fri, 25 Jun 2021 11:00:05 +0000 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lwjZ5-0000jw-2b for pgsql-bugs@lists.postgresql.org; Fri, 25 Jun 2021 11:00:04 +0000 Received: by mail-lj1-x22a.google.com with SMTP id r16so11926142ljk.9 for ; Fri, 25 Jun 2021 04:00:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=ypC9NqXSUiKGn8KgOvmZGopXxXgXopn3rPJXm2codTM=; b=LadjDBGlLgTOeEgbcxgkpFvUXWoPiPy2skbHBCjkSEKZ+cp9jcTbhPR4CZ/1S/rc/1 9nyqGGiSrnQ5ToCPF9GOIwxxvqyPAC1vh4i9Og0OmRxqlIEfo5sg1gyTdM+oF6L7VGJr ef7Wl+r2TdPyG7OAU/z69mrQIIinRWwRI1IpyCVfQKvVcSOuF0IzlqxvcR2tO122Ycsr yPEXn2T9I5Hh8scbN3Gt4cK+i2fGs+/RU2/eYPdGJ/HCiGFYwBhP79EifIFTfxTOAw0M v6iPOcDGSwHsTzZPXwTcDOuO+Tgt/GXBm8WLSv9KxL1qHawfZBm3Y1fzcnQgsvACNtYf fhVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=ypC9NqXSUiKGn8KgOvmZGopXxXgXopn3rPJXm2codTM=; b=OF1qvHQphM5EqRmftxtpJLzhIrArarSWk7JLkejnprconUC+G/l1GQmHD0W7oTWfPL T6WehTwfIGNPGFOeUSn/KhQou58E4flkG8iRvcmmiMhk0EGWYaCU54qtPJrOsU1goh7r jQNLjXOxsqLtOmmrc4eRlcGC2csJgqkpmaktoW5BPVYlBKKV+ltWQSfBDg7kHfG7HlXa Eli/H/VJ1msnuuIEack9pCo33yT/EvbbS9WLIKMy7yFsETTDmr8iwE2kOwqhJkSpds5b vLaAWGSUpTCY6kRyHjEv2qWYr7odFZtZ+ZVsjLXHHz4CjStuJTkQZW6MCzGhsoVupwc6 9tRA== X-Gm-Message-State: AOAM531y260uk2qTaIsTzFwqW78QA34QIJMD/y+hZqtyao0DNyuEI34D gzjNFEuTVOxqLBpe/c24CKS6YHMP1oAJEA== X-Google-Smtp-Source: ABdhPJyL3e9CjR+jM0ueQKbJ8f+4CwIVgcHT+vOMumoiuzxsTBtvOHBzMohgfiqx+ps3E+UnaVdtbg== X-Received: by 2002:a2e:b4f6:: with SMTP id s22mr7933462ljm.184.1624618801834; Fri, 25 Jun 2021 04:00:01 -0700 (PDT) Received: from [1.0.0.7] ([178.155.6.177]) by smtp.gmail.com with ESMTPSA id g10sm482249lfr.185.2021.06.25.04.00.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Jun 2021 04:00:01 -0700 (PDT) Subject: Re: BUG #17072: Assert for clogGroupNext failed due to a race condition in TransactionGroupUpdateXidStatus() To: Amit Kapila , PostgreSQL mailing lists References: <17072-2f8764857ef2c92a@postgresql.org> From: Alexander Lakhin Message-ID: Date: Fri, 25 Jun 2021 14:00:00 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello Amit, 25.06.2021 12:55, Amit Kapila wrote: > On Fri, Jun 25, 2021 at 12:20 AM PG Bug reporting form > wrote: >> The offending (the one that leaved a "valid" clogGroupNext) proccess is >> 60d48c2d.ea21. It looks like it got from the >> pg_atomic_compare_exchange_u32() the nextidx value that was written in the >> clogGroupFirst by the process 60d48c2e.ebc5, and exited just after that. >> > Your analysis seems to be in the right direction. Can you try by > setting clogGroupNext to INVALID_PGPROCNO > (pg_atomic_write_u32(&proc->clogGroupNext, INVALID_PGPROCNO);) before > we return false in the first while(true) loop in function > TransactionGroupUpdateXidStatus()? With this modification that assert is not triggered, all 100 iterations pass fine (triple checked). > I think this should be reproducible on all branches from HEAD till > v11. Have you tried in any other branch? I'll also try to reproduce > it. I've reproduced it on REL_11_STABLE, REL_12_STABLE, REL_13_STABLE, and master. Best regards, Alexander