BUG #15828: Server crashes inside CloneRowTriggersToPartition

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: exclusion(at)gmail(dot)com
Subject: BUG #15828: Server crashes inside CloneRowTriggersToPartition
Date: 2019-05-31 18:50:37
Message-ID: 15828-f6ddd7df4852f473@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: 15828
Logged by: Alexander Lakhin
Email address: exclusion(at)gmail(dot)com
PostgreSQL version: 12beta1
Operating system: Ubuntu 18.04
Description:

When running in parallel two queries (modified excerpts from
src/test/regress/ join.sql and update.sql):
--
SELECT count(*) FROM
tenk1 a JOIN tenk1 b ON a.unique1 = b.unique2
LEFT JOIN tenk1 c ON c.thousand = a.thousand;
--
DROP TABLE IF EXISTS range_parted CASCADE;
DROP FUNCTION IF EXISTS trigfunc CASCADE;

CREATE TABLE range_parted (b bigint) PARTITION BY RANGE (b);
CREATE TABLE part_1_10 PARTITION OF range_parted FOR VALUES FROM (1) TO
(10);

CREATE FUNCTION trigfunc() RETURNS TRIGGER LANGUAGE plpgsql AS 'begin return
null; end;';

CREATE TRIGGER trigger1 AFTER INSERT ON range_parted FOR EACH STATEMENT
EXECUTE PROCEDURE trigfunc();

CREATE TRIGGER trigger2 AFTER INSERT ON range_parted FOR EACH STATEMENT
EXECUTE PROCEDURE trigfunc();
DROP TRIGGER trigger2 ON range_parted;

INSERT INTO range_parted VALUES (0);
SELECT pg_sleep(0.05);
CREATE TABLE part_def PARTITION OF range_parted DEFAULT;
--
I get a crash with the following core dump:

Core was generated by `postgres: law regression [local] CREATE TABLE
'.
Program terminated with signal SIGBUS, Bus error.
#0 0x000055594492427f in GetMemoryChunkContext (pointer=0x5559466ff0a0)
at ../../../../src/include/utils/memutils.h:129
129 AssertArg(MemoryContextIsValid(context));
(gdb) bt
#0 0x000055594492427f in GetMemoryChunkContext (pointer=0x5559466ff0a0)
at ../../../../src/include/utils/memutils.h:129
#1 pfree (pointer=0x5559466ff0a0) at mcxt.c:1033
#2 0x00005559444dedc4 in btendscan (scan=<optimized out>) at nbtree.c:479
#3 0x00005559444d2eaf in index_endscan (scan=0x5559466fc9f0) at
indexam.c:328
#4 0x00005559444d25ed in systable_endscan
(sysscan=sysscan(at)entry=0x55594663ccc0) at genam.c:535
#5 0x0000555944604716 in CloneRowTriggersToPartition
(parent=parent(at)entry=0x7fcb7cbb97b8,
partition=partition(at)entry=0x7fcb7cbbd138) at tablecmds.c:15885
#6 0x00005559446155b4 in DefineRelation (stmt=stmt(at)entry=0x5559466e1050,
relkind=<optimized out>,
relkind(at)entry=114 'r', ownerId=10, ownerId(at)entry=0,
typaddress=typaddress(at)entry=0x0,
queryString=queryString(at)entry=0x55594661c788 "CREATE TABLE part_def
PARTITION OF range_parted DEFAULT;")
at tablecmds.c:1090
#7 0x00005559447cf575 in ProcessUtilitySlow
(pstate=pstate(at)entry=0x5559466e0f38, pstmt=pstmt(at)entry=0x55594661d718,
queryString=queryString(at)entry=0x55594661c788 "CREATE TABLE part_def
PARTITION OF range_parted DEFAULT;",
context=context(at)entry=PROCESS_UTILITY_TOPLEVEL, params=params(at)entry=0x0,
queryEnv=queryEnv(at)entry=0x0,
dest=0x55594661d810, completionTag=0x7ffe17b7bb00 "") at
utility.c:1014
#8 0x00005559447cf329 in standard_ProcessUtility (pstmt=0x55594661d718,
queryString=0x55594661c788 "CREATE TABLE part_def PARTITION OF
range_parted DEFAULT;",
context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0,
dest=0x55594661d810, completionTag=0x7ffe17b7bb00 "")
at utility.c:927
#9 0x00005559447cf3d7 in ProcessUtility (pstmt=pstmt(at)entry=0x55594661d718,
queryString=<optimized out>,
context=context(at)entry=PROCESS_UTILITY_TOPLEVEL, params=<optimized out>,
queryEnv=<optimized out>,
dest=dest(at)entry=0x55594661d810, completionTag=0x7ffe17b7bb00 "") at
utility.c:360
#10 0x00005559447cb87e in PortalRunUtility
(portal=portal(at)entry=0x555946683b58, pstmt=pstmt(at)entry=0x55594661d718,
isTopLevel=isTopLevel(at)entry=true,
setHoldSnapshot=setHoldSnapshot(at)entry=false, dest=dest(at)entry=0x55594661d810,

completionTag=completionTag(at)entry=0x7ffe17b7bb00 "") at pquery.c:1175
#11 0x00005559447cc4cd in PortalRunMulti
(portal=portal(at)entry=0x555946683b58, isTopLevel=isTopLevel(at)entry=true,
setHoldSnapshot=setHoldSnapshot(at)entry=false,
dest=dest(at)entry=0x55594661d810, altdest=altdest(at)entry=0x55594661d810,
completionTag=completionTag(at)entry=0x7ffe17b7bb00 "") at pquery.c:1321
#12 0x00005559447cd23d in PortalRun (portal=portal(at)entry=0x555946683b58,
count=count(at)entry=9223372036854775807,
isTopLevel=isTopLevel(at)entry=true, run_once=run_once(at)entry=true,
dest=dest(at)entry=0x55594661d810,
altdest=altdest(at)entry=0x55594661d810, completionTag=0x7ffe17b7bb00 "")
at pquery.c:796
#13 0x00005559447c94ed in exec_simple_query (
query_string=query_string(at)entry=0x55594661c788 "CREATE TABLE part_def
PARTITION OF range_parted DEFAULT;")
at postgres.c:1215
#14 0x00005559447cb4bd in PostgresMain (argc=<optimized out>,
argv=argv(at)entry=0x555946647dc0, dbname=<optimized out>,
username=<optimized out>) at postgres.c:4249
#15 0x000055594473dcaa in BackendRun (port=port(at)entry=0x555946640e80) at
postmaster.c:4431
#16 0x0000555944740ece in BackendStartup (port=port(at)entry=0x555946640e80) at
postmaster.c:4122
#17 0x00005559447411e5 in ServerLoop () at postmaster.c:1704
#18 0x00005559447425f2 in PostmasterMain (argc=8, argv=<optimized out>) at
postmaster.c:1377
#19 0x000055594469e26e in main (argc=8, argv=0x555946616b70) at main.c:228

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alexander Lakhin 2019-05-31 19:01:17 Re: BUG #15828: Server crashes inside CloneRowTriggersToPartition
Previous Message Michael Paquier 2019-05-31 17:17:11 Re: BUG #15789: libpq compilation with OpenSSL 1.1.1b fails on Windows with Visual Studio 2017