pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: fjz22@mails.tsinghua.edu.cn
To: pgsql-bugs@lists.postgresql.org
Cc: ljiee@mail.tsinghua.edu.cn
Cc: wuzy21@mails.tsinghua.edu.cn
Subject:  8. PostgreSQL Server 15.2 Subprocess Went down at function 'pg_detoast_datum_copy'
Date: Fri, 14 Apr 2023 00:45:43 +0800
Message-ID: <00d001d96e27$63514270$29f3c750$@mails.tsinghua.edu.cn> (raw)

Description: PostgreSQL Server 15.2 Subprocess Went down at function
'pg_detoast_datum_copy'

PostgreSQL Server Version: PostgreSQL 15.2 on x86_64-pc-linux-gnu, compiled
by Ubuntu clang version 12.0.1, 64-bit

Discoverer: Jingzhou Fu, Jie Liang and Zhiyong Wu in WingTecher Lab of
Tsinghua University and Shuimuyulin ltd

Email address: fjz22@mails.tsinghua.edu.cn  ,   wuzy21@mails.tsinghua.edu.cn
,  ljiee@mail.tsinghua.edu.cn

 

Way to Reproduce with Docker (write the poc content into file PoC.sql):

```bash

docker container rm some-postgres -f

docker run --name some-postgres -p 5432:5432 -e
POSTGRES_PASSWORD=mysecretpassword -d postgres:15.2

 

sleep 5 # wait the server start .

 

docker exec -i some-postgres psql --user=postgres < PoC.sql

 

# Output:

#   server closed the connection unexpectedly

#          This probably means the server terminated abnormally

#          before or while processing the request.

#   connection to server was lost

```

 

PoC:

```sql

create function tidrangescan(cstring) returns tidrangescan

  strict immutable language internal as 'int8in';

CREATE FUNCTION f2(tidrangescan)

   RETURNS cstring

   AS 'textout'

   LANGUAGE internal STRICT IMMUTABLE;

 

CREATE TYPE tidrangescan (

   internallength = variable,

   input = tidrangescan,

   output = f2,

   alignment = int4

);

 

CREATE CAST (int4 AS tidrangescan) WITH INOUT;

SELECT 1234::int4::tidrangescan;

```

 

Backtrace:

```

#0 0x1cba709 (pg_detoast_datum_copy+0x49)

#1 0x1358622 (evaluate_expr+0x322)

#2 0x135d9c5 (evaluate_function+0xd95)

#3 0x135b521 (simplify_function+0x431)

#4 0x134eb33 (eval_const_expressions_mutator+0x5773)

#5 0x111caaf (expression_tree_mutator+0x2daf)

#6 0x1355114 (eval_const_expressions_mutator+0xbd54)

#7 0x111d808 (expression_tree_mutator+0x3b08)

#8 0x1355114 (eval_const_expressions_mutator+0xbd54)

#9 0x1349343 (eval_const_expressions+0x2a3)

#10 0x12a5900 (preprocess_expression+0xf0)

#11 0x12a0186 (subquery_planner+0x1b66)

#12 0x129ba27 (standard_planner+0xbc7)

#13 0x129ae4c (planner+0x5c)

#14 0x16e1e66 (pg_plan_query+0xf6)

#15 0x16e2862 (pg_plan_queries+0x8a2)

#16 0x16e924d (exec_simple_query+0x9bd)

#17 0x16e7a63 (PostgresMain+0x1523)

#18 0x144c17b (BackendRun+0xbb)

#19 0x144ad85 (BackendStartup+0x525)

#20 0x14481e6 (ServerLoop+0x616)

#21 0x1443e0f (PostmasterMain+0x30cf)

#22 0x106ebf2 (main+0x5a2)

#23 0x7f98389dc083 (__libc_start_main+0xf3)

#24 0x49fc0e (_start+0x2e) 

```

 

Message-ID: <00d001d96e27$63514270$29f3c750$@mails.tsinghua.edu.cn>
Permalink:  ../00d001d96e27$63514270$29f3c750$@mails.tsinghua.edu.cn/
Also on:    postgresql.org/message-id/00d001d96e27$63514270$29f3c750$@mails.tsinghua.edu.cn

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: fjz22@mails.tsinghua.edu.cn, ljiee@mail.tsinghua.edu.cn, wuzy21@mails.tsinghua.edu.cn
  Subject: Re: 8. PostgreSQL Server 15.2 Subprocess Went down at function 'pg_detoast_datum_copy'
  In-Reply-To: <00d001d96e27$63514270$29f3c750$@mails.tsinghua.edu.cn>
  References: <00d001d96e27$63514270$29f3c750$@mails.tsinghua.edu.cn>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox