BUG #17620: JIT-Compiler causes Segmentation Fault

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: marcel(dot)spitz(at)envelio(dot)de
Subject: BUG #17620: JIT-Compiler causes Segmentation Fault
Date: 2022-09-22 15:52:07
Message-ID: 17620-b4605974fb6ba586@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 17620
Logged by: Marcel Spitz
Email address: marcel(dot)spitz(at)envelio(dot)de
PostgreSQL version: 13.8
Operating system: Debian GNU/Linux 11 (bullseye) on linux/arm64
Description:

This can be reproduced with the official Docker Image "postgres:13.8".
Steps to reproduce:
First install the Debian Package `postgresql-13-postgis-3`
Set the value of shared_buffers to be above "1967636kB" (shared_buffers =
2GB will do)

Execute the following script:

```
SET jit_above_cost = 1;

CREATE TABLE IF NOT EXISTS t1 (
int_id BIGINT primary key,
text_id varchar
);

CREATE UNIQUE INDEX index_1 ON t1 (text_id);

CREATE TABLE IF NOT EXISTS t2
(
ext_id bigint,
text_id varchar,
int_id bigint,
a bigint,
b bigint,
c bigint,
d bigint,
e bigint,
f bigint
);
INSERT INTO t2 (ext_id, text_id) VALUES (0,0);

CREATE INDEX index_2 on t2 (text_id);

UPDATE t2 SET int_id = t1.int_id FROM t1 WHERE t2.text_id = t1.text_id;
```
With the Update Statement a Segmentation Fault occurs and this is what shows
in the logs (with DEBUG5)

```
[43] DEBUG: StartTransaction(1) name: unnamed; blockState: DEFAULT; state:
INPROGRESS, xid/subid/cid: 0/1/0
[43] DEBUG: time to inline: 0.000s, opt: 0.000s, emit: 0.003s
psql:/files/test.sql:32: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
psql:/files/test.sql:32: fatal: connection to server was lost
[33] DEBUG: reaping dead processes
[33] DEBUG: server process (PID 43) was terminated by signal 11:
Segmentation fault
[33] DETAIL: Failed process was running: UPDATE t2 SET int_id = t1.int_id
FROM t1 WHERE t2.text_id = t1.text_id;
[33] LOG: server process (PID 43) was terminated by signal 11: Segmentation
fault
[33] DETAIL: Failed process was running: UPDATE t2 SET int_id = t1.int_id
FROM t1 WHERE t2.text_id = t1.text_id;
[33] LOG: terminating any other active server processes
[33] DEBUG: sending SIGQUIT to process 40
[33] DEBUG: sending SIGQUIT to process 36
[33] DEBUG: sending SIGQUIT to process 35
[33] DEBUG: sending SIGQUIT to process 37
[33] DEBUG: sending SIGQUIT to process 38
[33] DEBUG: sending SIGQUIT to process 39
[39] DEBUG: writing stats file "pg_stat/global.stat"
[39] DEBUG: writing stats file "pg_stat/db_13445.stat"
[39] DEBUG: removing temporary stats file "pg_stat_tmp/db_13445.stat"
[38] WARNING: terminating connection because of crash of another server
process
[38] DETAIL: The postmaster has commanded this server process to roll back
the current transaction and exit, because another server process exited
abnormally and possibly corrupted shared memory.
[38] HINT: In a moment you should be able to reconnect to the database and
repeat your command.
[39] DEBUG: writing stats file "pg_stat/db_0.stat"
[39] DEBUG: removing temporary stats file "pg_stat_tmp/db_0.stat"
[39] DEBUG: shmem_exit(-1): 0 before_shmem_exit callbacks to make
[39] DEBUG: shmem_exit(-1): 0 on_shmem_exit callbacks to make
[39] DEBUG: proc_exit(-1): 0 callbacks to make
[33] LOG: all server processes terminated; reinitializing
[33] DEBUG: shmem_exit(1): 0 before_shmem_exit callbacks to make
[33] DEBUG: shmem_exit(1): 5 on_shmem_exit callbacks to make
[33] DEBUG: cleaning up dynamic shared memory control segment with ID
209425142
```

A core dump is produced as well, but it is not of any use, i presume because
of JIT Compilation

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Dmitry Astapov 2022-09-22 16:11:13 Re: BUG #17619: AllocSizeIsValid violation in parallel hash join
Previous Message Dmitry Astapov 2022-09-22 12:51:27 Re: BUG #17619: AllocSizeIsValid violation in parallel hash join