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 1mk8RP-0006kg-9x for pgsql-bugs@arkaria.postgresql.org; Mon, 08 Nov 2021 17:28:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mk8RO-0000rT-11 for pgsql-bugs@arkaria.postgresql.org; Mon, 08 Nov 2021 17:28:18 +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 1mk8RN-0000rK-NH for pgsql-bugs@lists.postgresql.org; Mon, 08 Nov 2021 17:28:17 +0000 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1mk8RI-00017T-TM for pgsql-bugs@lists.postgresql.org; Mon, 08 Nov 2021 17:28:16 +0000 Received: by mail-wr1-x42c.google.com with SMTP id w29so16655100wra.12 for ; Mon, 08 Nov 2021 09:28:12 -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:content-transfer-encoding:in-reply-to; bh=5M2dRTFEAJV+mcwKqBjpRUU/2vcydmazMZfuaXqgdTk=; b=UsWRSz8gTp9MkIZHcoWAgVqk1DMd4VFbsASJ31yBPx+ktMKr5S9Mv8J0RBI83O/SR4 EZX2EjaSaOjH/5vy+mXxkSzBikG+x4MfdSfntT6fZobcEA7aVqOF6uz2JwI4eikMvYy0 Vvgd5bXgEwR2d+J2yinUcswAjp37cBhKZNJ4eYsJGzHgTonnP45uUkFBqjbXmTC9nuGX xaMnO6hsrxaJnp6ERnNkVb0NXQpak28ujYJFgD5/wIH0MOnB/w4oJ+70SdROmiry+U2d v0uxYKWktA45z7ICwCcFhZ/pVo86iY87hzcpdf56ETBzdZLEt3R0DWrGnUYCGzUBicHE sehQ== 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:content-transfer-encoding :in-reply-to; bh=5M2dRTFEAJV+mcwKqBjpRUU/2vcydmazMZfuaXqgdTk=; b=4YSxs6KeNFgKzNSU80AkcyZBB6AUItKAP7tDDj5oZ4anTVwFJQ8wEL5FzvBDR0zk1S I7ZcRi2TF0X9OJKK9kqg27Vr4nB9VMQ4I4UBc4Bxp267UOt1xMOF/B+iNHnx/41cxNPR NHlHWStoCTvI4TM0x/y+gm5h5DESUHBum7MJTH0UDrOtKE2YyIuq90FZfK0BFYKmK4AJ lmfEINGQTUOBq7euKZbmrpC6tq2hmAiFylmpnkPqr4xm/OZGZLq2p+njBQhTvsgHtXoo gq0dJmeHTdlFBeIqPDQCLv6BBhKtsPEcAxoaDjUKRVf4i6XnrF8JWhq3BKnlPPMykLp6 m/pA== X-Gm-Message-State: AOAM530UiaRZkKQfVc0WneTpxXt8a0XZ7WCS9wLOIdXVN3TQs/oWoKzu +V6Ww0/Su/UnR3z2eHHfE6k= X-Google-Smtp-Source: ABdhPJw43fZjqUyKmHg5SM6XHzP/E9iHIvxWn2QuZDbMzlROeGrNae9duNDmwMi7CZERHwU+EEYYGw== X-Received: by 2002:adf:efc6:: with SMTP id i6mr964420wrp.428.1636392491304; Mon, 08 Nov 2021 09:28:11 -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 i15sm19694808wmb.20.2021.11.08.09.28.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Nov 2021 09:28:10 -0800 (PST) Date: Mon, 8 Nov 2021 18:28:52 +0100 From: Dmitry Dolgov <9erthalion6@gmail.com> To: Alexander Lakhin Cc: Andres Freund , Peter Geoghegan , Matthias van de Meent , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17255: Server crashes in index_delete_sort_cmp() due to race condition with vacuum Message-ID: <20211108172852.pvsarxoxi54uatch@localhost> References: <17255-14c0ac58d0f9b583@postgresql.org> <20211029145532.kfwqwlrdekunwoa2@localhost> <20211030213948.3i3f7cieqxzhd7kq@alap3.anarazel.de> <20211031192051.e3r2uxft3bulymrr@localhost> <08c2445c-c3c9-ba45-18d3-6399707d8306@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <08c2445c-c3c9-ba45-18d3-6399707d8306@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Sun, Nov 07, 2021 at 09:00:00PM +0300, Alexander Lakhin wrote: > 31.10.2021 22:20, Dmitry Dolgov wrote: > >> > >> I suspect this is the same bug as #17245. Could you check if it's fixed by > >> https://www.postgresql.org/message-id/CAH2-WzkN5aESSLfK7-yrYgsXxYUi__VzG4XpZFwXm98LUtoWuQ%40mail.gmail.com > >> > >> The crash is somewhere in pg_class, which is also manually VACUUMed by the > >> test, which could trigger the issue we found in the other thread. The likely > >> reason the loop in the repro is needed is that that'll push one of the indexes > >> on pg_class over the 512kb/min_parallel_index_scan_size boundary to start > >> using paralell vacuum. > > I've applied both patches from Peter, the fix itself and > > index-points-to-LP_UNUSED-item assertions. Now it doesn't crash on > > pg_unreachable, but hits those extra assertions in the second patch: > Yes, the committed fix for the bug #17245 doesn't help here. > I've also noticed that the server crash is not the only possible > outcome. You can also get unexpected errors like: > ERROR:  relation "errtst_parent" already exists > ERROR:  relation "tmp_idx1" already exists > ERROR:  relation "errtst_child_plaindef" already exists > or > ERROR:  could not open relation with OID 1033921 > STATEMENT:  DROP TABLE errtst_parent; > in the server.log (and no crash). 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: #0 0x00007f0dfce072fb in raise () from /lib64/libc.so.6 #1 0x00007f0dfcdf0ef6 in abort () from /lib64/libc.so.6 #2 0x000055a66a87db05 in ExceptionalCondition (conditionName=0x55a66a914610 "HeapTupleHeaderIsHeapOnly(htup)", errorType=0x55a66a91419c "FailedAssertion", fileName=0x55a66a914190 "pruneheap.c", lineNumber=961) at assert.c:69 #3 0x000055a66a21b83a in heap_page_prune_execute (buffer=138, redirected=0x7fffac638994, nredirected=0, nowdead=0x7fffac638e20, ndead=12, nowunused=0x7fffac639066, nunused=1) at pruneheap.c:961 #4 0x000055a66a219d82 in heap_page_prune (relation=0x7f0dfdca0e20, buffer=138, vistest=0x55a66addf140 , old_snap_xmin=0, old_snap_ts=0, report_stats=true, off_loc=0x0) at pruneheap.c:295 The relation in question is pg_class, and htup apparently has e.g. HEAP_KEYS_UPDATED, but no HEAP_ONLY_TUPLE flags set: >>> p *htup $1 = { t_choice = { t_heap = { t_xmin = 661929, t_xmax = 662015, t_field3 = { t_cid = 0, t_xvac = 0 } }, t_datum = { datum_len_ = 661929, datum_typmod = 662015, datum_typeid = 0 } }, t_ctid = { ip_blkid = { bi_hi = 0, bi_lo = 2004 }, ip_posid = 128 }, t_infomask2 = 8225, t_infomask = 1281, t_hoff = 32 ' ', t_bits = 0x7f0de7080ee7 "\377\377\377?" }