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 1nFJlO-0005fU-Bo for pgsql-bugs@arkaria.postgresql.org; Wed, 02 Feb 2022 17:49:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nFJlN-0005hi-54 for pgsql-bugs@arkaria.postgresql.org; Wed, 02 Feb 2022 17:49:49 +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 1nFJlM-0005h8-TF for pgsql-bugs@lists.postgresql.org; Wed, 02 Feb 2022 17:49:48 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nFJlK-0004Xp-Ix for pgsql-bugs@lists.postgresql.org; Wed, 02 Feb 2022 17:49:47 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 212HnRWe014518; Wed, 2 Feb 2022 12:49:27 -0500 From: Tom Lane To: Pasi Eronen cc: Peter Eisentraut , Peter Geoghegan , PostgreSQL mailing lists Subject: Re: BUG #17362: Error "could not find block containing chunk" when using index with icu collation on CentOS 7 In-reply-to: References: <17362-63967721ee562fa7@postgresql.org> <3869d444-2f89-f157-318d-a71ed712dcb7@enterprisedb.com> Comments: In-reply-to Pasi Eronen message dated "Wed, 02 Feb 2022 16:39:29 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <14516.1643824167.1@sss.pgh.pa.us> Date: Wed, 02 Feb 2022 12:49:27 -0500 Message-ID: <14517.1643824167@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Pasi Eronen writes: > In varlena.c, ssup_extra->buf1 and buf2 are initialized to 1024-byte > buffers, allocated from the ssup->ssup_cxt memory context. That > strange-looking test string in my bug report just happens to be 1044 > bytes, so a larger buffer is needed at some point. > If growing the buffer happens in "varstrfastcmp_locale", it uses > MemoryContextAlloc(ssup->ssup_cxt, ...). But if growing the buffer > happens in "varstr_abbrev_convert", it just calls "palloc" - and > apparently the current memory context is not ssup_cxt at this point > (at least according to debugging printf's I added). > Might this be causing the problem? Indeed. The whole thing seems flat-out wrong to me: repalloc would be shorter, safer, and more idiomatic. regards, tom lane