Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t9k9i-00Byfp-9O for pgsql-bugs@arkaria.postgresql.org; Sat, 09 Nov 2024 12:01:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t9k9e-000rlQ-P3 for pgsql-bugs@arkaria.postgresql.org; Sat, 09 Nov 2024 12:01:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t9k9e-000rki-Fk for pgsql-bugs@lists.postgresql.org; Sat, 09 Nov 2024 12:01:27 +0000 Received: from relay4-d.mail.gandi.net ([2001:4b98:dc4:8::224]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t9k9b-000xsh-N5 for pgsql-bugs@lists.postgresql.org; Sat, 09 Nov 2024 12:01:25 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 5F717E0003; Sat, 9 Nov 2024 12:01:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vondra.me; s=gm1; t=1731153678; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YQdWaGJsK2jP6dUYZgQJxBaJHK9VDHiDUKWhrHRuKyA=; b=A49Wy2HepKz2gXygb0QJ5aONYF1LoC18fZjg9ngbhi0L0T+Oz3Jg9LN1Hr6FiY5UVhk5E6 anQ/bjoH1KsFtU+gV/lf2SxB31xjvECEFLegeJQsSSLSz7wG+R6ugOwd6FhBeBXr/CWZQe 2t6j1DVZDNUlpfBJNF9dAn69+bRWqaw9/YLJ4f9NP9DOLi/HPnD2dxB+UWbcz4fmnVMTf3 4C4mWIt/JWESFMGyJnUgE66TMoil7lBvXiP27BExpBSaIHpz8xT9QtKTZoLQg4PYtfh+/Z Ucv/FGpJpbEfdSm4Tk7LGK7QCYJjDjLmDFBKfIKcod8SH59N+VV9tMwxU5AyCg== Message-ID: Date: Sat, 9 Nov 2024 13:01:17 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Segmentation fault - PostgreSQL 17.0 To: =?UTF-8?B?xL11Ym9zbGF2IMWgcGlsw6Fr?= , "pgsql-bugs@lists.postgresql.org" References: Content-Language: en-US From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-GND-Sasl: tomas@vondra.me List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 11/8/24 18:22, Ľuboslav Špilák wrote: > Hello. > > I am trying postgresql17 partitioning tables and check brin indexes with > error* Segmenation fault.*  > We upgraded db from last PostgreSQL12 to 17.0 using pg_upgrade binary. > Everything seems to be OK. Only this select is problem. >     > select * from brin_page_items( >           get_raw_page('test1_table_2022q3_timeseries_id_time_idx',2), >           'test1_table_2022q3_timeseries_id_time_idx' >         ) > > Welcome to *Ubuntu 20.04.6 *LTS (GNU/Linux 5.4.0-200-generic x86_64) > *PostgreSQL 17.0* (Ubuntu 17.0-1.pgdg20.04+1) on x86_64-pc-linux-gnu, > compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0, 64-bit > > > 2024-11-08 18:12:20.861 CET [12350] LOG:  starting PostgreSQL 17.0 > (Ubuntu 17.0-1.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc > (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0, 64-bit > 2024-11-08 18:12:20.864 CET [12350] LOG:  listening on IPv4 address > "0.0.0.0", port 5432 > 2024-11-08 18:12:20.867 CET [12350] LOG:  could not create IPv6 socket > for address "::": Address family not supported by protocol > 2024-11-08 18:12:20.868 CET [12350] LOG:  listening on Unix socket "/ > var/run/postgresql/.s.PGSQL.5432" > 2024-11-08 18:12:20.878 CET [12357] LOG:  database system was shut down > at 2024-11-08 18:12:19 CET > 2024-11-08 18:12:20.890 CET [12350] LOG:  database system is ready to > accept connections > 2024-11-08 18:12:41.055 CET [12350] LOG:  *server process (PID 12376) > was terminated by signal 11: Segmentation fault* > 2024-11-08 18:12:41.055 CET [12350] DETAIL:  Failed process was running: > select * >         from brin_page_items( >           get_raw_page('test1_table_2022q3_timeseries_id_time_idx',2), >           'test1_table_2022q3_timeseries_id_time_idx' >         ) > 2024-11-08 18:12:41.055 CET [12350] LOG:  terminating any other active > server processes > 2024-11-08 18:12:41.058 CET [12350] LOG:  all server processes > terminated; reinitializing > 2024-11-08 18:12:41.276 CET [12379] LOG:  database system was > interrupted; last known up at 2024-11-08 18:12:20 CET > 2024-11-08 18:12:41.293 CET [12382] postgres@xtimeseries FATAL:  the > database system is in recovery mode > 2024-11-08 18:12:41.319 CET [12383] postgres@xtimeseries FATAL:  the > database system is in recovery mode > 2024-11-08 18:12:41.346 CET [12384] postgres@xtimeseries FATAL:  the > database system is in recovery mode > 2024-11-08 18:12:41.364 CET [12379] LOG:  database system was not > properly shut down; automatic recovery in progress > 2024-11-08 18:12:41.371 CET [12379] LOG:  redo starts at FE49/7A5FBCD0 > 2024-11-08 18:12:41.371 CET [12379] LOG:  invalid record length at > FE49/7A5FBD08: expected at least 24, got 0 > 2024-11-08 18:12:41.371 CET [12379] LOG:  redo done at FE49/7A5FBCD0 > system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s > 2024-11-08 18:12:41.371 CET [12385] postgres@xtimeseries FATAL:  the > database system is in recovery mode > 2024-11-08 18:12:41.384 CET [12380] LOG:  checkpoint starting: end-of- > recovery immediate wait > 2024-11-08 18:12:41.401 CET [12386] postgres@xtimeseries FATAL:  the > database system is not yet accepting connections > 2024-11-08 18:12:41.401 CET [12386] postgres@xtimeseries DETAIL: >  Consistent recovery state has not been yet reached. > 2024-11-08 18:12:41.408 CET [12380] LOG:  checkpoint complete: wrote 2 > buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.017 > s, sync=0.002 s, total=0.026 s; sync files=3, longest=0.001 s, > average=0.001 s; distance=0 kB, estimate=0 kB; lsn=FE49/7A5FBD08, redo > lsn=FE49/7A5FBD08 > 2024-11-08 18:12:41.413 CET [12350] LOG:  database system is ready to > accept connections > > What could be wrong? Hard to say, really. It would be interesting to see the backtrace from the crash. Considering you're able to trigger the issue easily, it shouldn't be too difficult to attach GDB to a backend before running the query. Alternatively, you can enable core files, and generate the backtrace from that. Presumably the index is a simple BRIN minmax index? Or what opclass does it use? Any special parameters? Is the index working otherwise, producing correct results? regards -- Tomas Vondra