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 1mjmSf-0003K9-Cw for pgsql-bugs@arkaria.postgresql.org; Sun, 07 Nov 2021 18:00:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mjmSd-0007Xe-2w for pgsql-bugs@arkaria.postgresql.org; Sun, 07 Nov 2021 18:00:07 +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 ) id 1mjmSc-0007Wd-PA for pgsql-bugs@lists.postgresql.org; Sun, 07 Nov 2021 18:00:06 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mjmSa-00070j-DO for pgsql-bugs@lists.postgresql.org; Sun, 07 Nov 2021 18:00:05 +0000 Received: by mail-lf1-x12e.google.com with SMTP id bi35so30996131lfb.9 for ; Sun, 07 Nov 2021 10:00:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=tyJ+xAfqB0ZEp8e2XsqOOlPeQZcP6T3Ckca384ldlJA=; b=RNbWbFR5/WYROPIr8+hAKVp/zZxt6ZI7FsNYprAy1U5FfCRZT0rBa3M3IJMBXkjnkV LR/sWWe8/zvUtNFZSvawncRHsL4N+vuznWFkpcuWDAP0yRvIaxBkz2No8RaF0IryxIqX Ss0aNoi4+iVBT5umQp5DgOk+p9GPTSCWZNTxsyMYwQDf2F8U04W84ZDpNvpgaDsZXZMp jWObMDzJN6AhyRhdjyqz/MYUBtxU5B4Dzq7JBVNpmWNm3JBS6bkcspakyVLOZPSLlMcl sxN9jaCGQCCa7KW6DQjodly7xx1+JqkNSprdI7sRgmv/p1AJQ0fVkDB7I4zv+uSjleZi V6hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=tyJ+xAfqB0ZEp8e2XsqOOlPeQZcP6T3Ckca384ldlJA=; b=kQaQVrk287vbC74VsdvFLk0/xu8xYZK6fSSApiPca0mcwyvjmbZ5HN9M6xc4q1n2JA wtF6+6f+u2YZqY61PUX4hPDJeLdk+fCOaWblD4Cpecc4i+M0d3fCcp+mU9p8b9fuvByl ZqHABMevZz/+X+dDO3EkUluOzgjwS85JBsaMbCFwgere6VBVWfHvnhJTQOmOdlEK9Iu7 kZDBxuvqDoIX42inn4plSQfedaigY2Tg1NgEYpzfru4vISBmdgZqMKhxsSS+PqH7P8RR INPvCNUvBj2vOWZxWN1Ownhxe2/xeVGgYiP1XrCqSvceRczRp0/q/Eh4nyccATtZkmZB Yk9Q== X-Gm-Message-State: AOAM532cE/06fYl+NIpK8V5chQ1ME4UJgC7gD5XBcsdlto9BkIMEpkDL C/ll9u9s57dxbdDrkAXpBxZsgShiqRArLA== X-Google-Smtp-Source: ABdhPJwXvsKcteJHLVuVcDsf4YRlTASfydyww3nFqPf+9xLerxpGrDx0tkd+jooP+6kP1mVz621QtQ== X-Received: by 2002:a05:6512:1102:: with SMTP id l2mr68460678lfg.469.1636308002584; Sun, 07 Nov 2021 10:00:02 -0800 (PST) Received: from [1.0.0.7] ([178.155.6.139]) by smtp.gmail.com with ESMTPSA id bi37sm296050lfb.12.2021.11.07.10.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Nov 2021 10:00:02 -0800 (PST) Subject: Re: BUG #17255: Server crashes in index_delete_sort_cmp() due to race condition with vacuum To: Dmitry Dolgov <9erthalion6@gmail.com>, Andres Freund , Peter Geoghegan , Matthias van de Meent Cc: pgsql-bugs@lists.postgresql.org References: <17255-14c0ac58d0f9b583@postgresql.org> <20211029145532.kfwqwlrdekunwoa2@localhost> <20211030213948.3i3f7cieqxzhd7kq@alap3.anarazel.de> <20211031192051.e3r2uxft3bulymrr@localhost> From: Alexander Lakhin Message-ID: <08c2445c-c3c9-ba45-18d3-6399707d8306@gmail.com> Date: Sun, 7 Nov 2021 21:00:00 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20211031192051.e3r2uxft3bulymrr@localhost> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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). These strange errors and the crash inside index_delete_sort_cmp() can be seen starting from the commit dc7420c2. On the previous commit (b8443eae) the reproducing script completes without a crash or errors (triple-checked). Probably, the bug #17257 has the same root cause, but the patch [1] applied to REL_14_STABLE (b0f6bd48) doesn't prevent the crash. Initially I've thought that the infinite loop in vacuum is a problem itself, so I decided to separate that one, but maybe both bugs are too related to be discussed apart. Best regards, Alexander [1] https://www.postgresql.org/message-id/CAEze2Wj7O5tnM_U151Baxr5ObTJafwH%3D71_JEmgJV%2B6eBgjL7g%40mail.gmail.com