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 1mwkKA-000414-5t for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Dec 2021 12:20:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mwkK9-0002an-2p for pgsql-bugs@arkaria.postgresql.org; Mon, 13 Dec 2021 12:20:57 +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 1mwkK8-0002ae-Of for pgsql-bugs@lists.postgresql.org; Mon, 13 Dec 2021 12:20:56 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1mwkK6-0003O6-4p for pgsql-bugs@lists.postgresql.org; Mon, 13 Dec 2021 12:20:55 +0000 Received: by mail-wm1-x334.google.com with SMTP id i12so11761323wmq.4 for ; Mon, 13 Dec 2021 04:20:53 -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=wfZYRGBNdNdy3dgHAUxACd4kufmMQxoK7oFw/zqtWbg=; b=oD5nv4N7a2qJxzv1Elo1POcE77Tv6pZRNAow23yFkfQqqi/HdttDJTECH1laZ07KWO yJSHNZKiWqcem/CjNmkhZ0kjVSY4dTnuVTS9gntt21TGS2YAevtDM5H6+D1Yh8YWpwvn Kbmv+d9y6NRhPepX27oqClLg1wdsyXsVulldKsFdGBdZDFDlTUK3pd3xrB+qZrPZM7qX 354TT57QQY6kH8vBHF1Ac5cnWR9QUI11L/Pckef3bNlReCcEYYvIz1U1ry73LQBVhCCb G5TNLdcmWBkFjbxen/UVk32NffzW+dWkvQ2NKrjQs010vEP8T+oGcjz/x5q56nTTRcWN aanw== 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=wfZYRGBNdNdy3dgHAUxACd4kufmMQxoK7oFw/zqtWbg=; b=sro9+ZatIJr6oZEJcRS19hL8kyQn/kAJvlsSa6loGw0QjvSzuFsXBSD69bPvnU4tHE 9usF5RumfPOrFkOHHFj5Min80yb+J7d/c6TW+LeR68msaUnGLa0lqx2+Fqxr/yDYizWa TR9ndCvxhbq0h97x7Yb9MxnDQUBJ9GRvXzQF2L5x7vtv9VJYbkWF+cIJ2UF3Kev7oV5X Zf/tjYDwvrPJXZQzaytpzGCFEvPfM7BMIBN+kZtRtQms6X52guk3J4dPs3thdTmcRqqY +WQe+FWWALaejVQH91dndJxp4QUXRaC1scfmlvzumgmXkgypQI8fn4zVsO2mTk3Y86iC XjDg== X-Gm-Message-State: AOAM531ByPAQppPvtKo43GFgAWVGsUa0fxWClP3eYOTptp5KKLJcZ9kb YPYAZgx8NaFcgSwQhNVXc0Gp7jcZ49k= X-Google-Smtp-Source: ABdhPJzUfuEiklyd254Si22v2CC7rA3Iqsb+zn08WI6nnEgqgZPNonMmR42m4rsX1flhut/3DB7oEg== X-Received: by 2002:a1c:a58d:: with SMTP id o135mr36283189wme.93.1639398051856; Mon, 13 Dec 2021 04:20:51 -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 b19sm7599473wmb.38.2021.12.13.04.20.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Dec 2021 04:20:50 -0800 (PST) Date: Mon, 13 Dec 2021 13:21:54 +0100 From: Dmitry Dolgov <9erthalion6@gmail.com> To: Andres Freund Cc: Peter Geoghegan , Alexander Lakhin , 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: <20211213122154.4dhb4cmigqxhsuba@localhost> References: <20211111030821.2xxl75qfkynaga4j@alap3.anarazel.de> <20211112222919.e7fkfpbpcoje6hsj@alap3.anarazel.de> <20211113150640.vk5zhjangylufxaa@localhost> <20211211045826.bmtdqxn2xuk5l4yl@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211211045826.bmtdqxn2xuk5l4yl@alap3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Fri, Dec 10, 2021 at 08:58:26PM -0800, Andres Freund wrote: > Hi, > > On 2021-11-13 16:06:40 +0100, Dmitry Dolgov wrote: > > I've got curious if modifying the Alexander's test case could reveal > > something interesting, and sprinkled it with savepoints and rollbacks. > > Almost immediately a new problem has manifested itself, although the > > crash has nothing to do with the disconnected tuples as far as I can > > tell -- still probably worth mentioning. In this case vacuum invoked > > lazy_scan_prune, and during the first scan one of the chains had a > > HEAPTUPLE_DEAD at the third position. The processing flow fell through > > to heap_prune_record_prunable and crashed on an assert with an > > InvalidTransactionId: > > > > #3 0x000055a2b260d1f9 in heap_prune_record_prunable (prstate=0x7ffd0c0ecdf0, xid=0) at pruneheap.c:872 > > #4 0x000055a2b260ca72 in heap_prune_chain (buffer=2117, rootoffnum=150, prstate=0x7ffd0c0ecdf0) at pruneheap.c:695 > > #5 0x000055a2b260bcd6 in heap_page_prune (relation=0x7fb98e217e20, buffer=2117, vistest=0x55a2b31d2d60 , old_snap_xmin=0, old_snap_ts=0, report_stats=false, off_loc=0x55a2b3e6a0cc) at pruneheap.c:288 > > #6 0x000055a2b261309c in lazy_scan_prune (vacrel=0x55a2b3e6a060, buf=2117, blkno=192, page=0x7fb97856bf80 "", vistest=0x55a2b31d2d60 , prunestate=0x7ffd0c0ee9d0) at vacuumlazy.c:1739 > > > > Applying heap_prune_record_prunable only if TransactionIdIsNormal seems > > to help. The original implementation didn't reach > > heap_prune_record_prunable either and also doesn't crash. > > Does your modified test still find problems with 0001 & 0002 from > https://postgr.es/m/20211211045710.ljtuu4gfloh754rs%40alap3.anarazel.de > applied? Nope, everything seems to be working smoothly.