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 1mkSd5-0004Jr-1p for pgsql-bugs@arkaria.postgresql.org; Tue, 09 Nov 2021 15:01:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mkSd3-0008Nr-RM for pgsql-bugs@arkaria.postgresql.org; Tue, 09 Nov 2021 15:01:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1mkSd3-0008Jo-Iw for pgsql-bugs@lists.postgresql.org; Tue, 09 Nov 2021 15:01:41 +0000 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1mkScx-0002t1-9m for pgsql-bugs@lists.postgresql.org; Tue, 09 Nov 2021 15:01:40 +0000 Received: by mail-wr1-x433.google.com with SMTP id d3so33493130wrh.8 for ; Tue, 09 Nov 2021 07:01:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=t6ZqR+u0l9S4WsRKHh6SjbBxzbS8a+j2lL5fz77FP0w=; b=lFGy4WvjHq6ZiSVHD0FGNa2RxB6xhL7olzk6mGx7t5g8uJ64vs7xZtI/e+sSd9bmml MzBB+ArKdisxOdyyiOh2BW++cUnyoq5bbkz/Dj9jZ4XNzzwx4tKM2PgavtErJb2x0vcW F/Tx8XJbL7fMhFLPPsd+WV0zn6TZtuCGijCmCNCad4GTAHDeThcb1WVFiHyFIrUZJSuA 4NxkiTXgzlSMnsmOHZTIHR4JqJ86UcWrt14ju5NdRkEQeSEKtQB2Oz4+hRZkaOOAABi0 BHxi/ZIcSelwp5mMreptFvnx2lBkZuylO/tkzPuI4NbJ/6JApf+2iD7s0FdwLGm4Jfuz rAeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=t6ZqR+u0l9S4WsRKHh6SjbBxzbS8a+j2lL5fz77FP0w=; b=FSbKdGqtQZGB5s+mob+tjKZEQLOCtGreGgVmJKo1PMjFTLcO+P8QInkaeL/qHFNEco kxT2izoDgWWmifUGFiqeACzx7JOd3LEdzlN6yHjoY2JmjYfrJej6bfi++C58dggCeJDW bFAPJfxklBFBb1oQA3PMcEUM3ivy108L9wDQoy3LuXeYwb0fbARkteH/2nKmVPZZiHyb 4riC43sXPznvnbD56hweDZQ2dm8o1BkmOqC8XeOPHGAb9S1Ngrer+VoPz514xriv8nDZ 4GaEdpE86xAxajd0nTxOMr+z98Zf/XsSVvJk1mDNLMrubWBC9mJxAkteH2+cnm37Aimv wmOw== X-Gm-Message-State: AOAM532+lML0ZpedAnJG9tZ3gduMv1HUNyEPEsWcfOKWaRqortv3XOTr n86vHPv+LftQi5tPkGKKvuM= X-Google-Smtp-Source: ABdhPJxyDOio8T5tA2/rTc8F49PSFVOzkUE0ywXyCIL8Oy5QURpkiHixISML5Fs6WSXXev7azjyegg== X-Received: by 2002:a5d:6244:: with SMTP id m4mr10103693wrv.186.1636470094053; Tue, 09 Nov 2021 07:01:34 -0800 (PST) Received: from localhost (dslb-178-012-041-031.178.012.pools.vodafone-ip.de. [178.12.41.31]) by smtp.gmail.com with ESMTPSA id 4sm27741027wrz.90.2021.11.09.07.01.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Nov 2021 07:01:33 -0800 (PST) Date: Tue, 9 Nov 2021 16:02:16 +0100 From: Dmitry Dolgov <9erthalion6@gmail.com> To: Peter Geoghegan Cc: Alexander Lakhin , Andres Freund , Matthias van de Meent , PostgreSQL mailing lists Subject: Re: BUG #17255: Server crashes in index_delete_sort_cmp() due to race condition with vacuum Message-ID: <20211109150216.fgfybn35mwnkeef3@localhost> References: <17255-14c0ac58d0f9b583@postgresql.org> <20211029145532.kfwqwlrdekunwoa2@localhost> <20211030213948.3i3f7cieqxzhd7kq@alap3.anarazel.de> <20211031192051.e3r2uxft3bulymrr@localhost> <08c2445c-c3c9-ba45-18d3-6399707d8306@gmail.com> <20211108172852.pvsarxoxi54uatch@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Mon, Nov 08, 2021 at 10:32:39AM -0800, Peter Geoghegan wrote: > On Mon, Nov 8, 2021 at 9:28 AM Dmitry Dolgov <9erthalion6@gmail.com> wrote: > > Interesting, I don't think I've observed those errors. In fact after the > > recent changes (I've compiled here from 39a31056) around assertion logic > > and index_delete_check_htid now I'm getting another type of crashes > > using your scripts. This time heap_page_prune_execute stumbles upon a > > non heap-only tuple trying to update unused line pointers: > > It looks like the new heap_page_prune_execute() assertions catch the > same problem earlier. It's hard to not suspect the code in pruneheap.c > itself. Whatever else may have happened, the code in pruneheap.c ought > to not even try to set a non-heap-only tuple item to LP_UNUSED. ISTM > that it should explicitly look out for and avoid doing that. > > Offhand, I wonder if we just need to have an additional check in > heap_prune_chain(), which is like the existing "If we find a redirect > somewhere else, stop --- it must not be same chain" handling used for > LP_REDIRECT items that aren't at the start of a HOT chain: Yes, adding such condition works in this case, no non-heap-only tuples were recorded as unused in heap_prune_chain, and nothing else popped up afterwards. But now after a couple of runs I could also reproduce (at least partially) what Alexander was talking about: ERROR: could not open relation with OID 1056321 Not sure yet where is it coming from.