BUG #16095: Segfault while executing trigger

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: tbutz(at)optitool(dot)de
Subject: BUG #16095: Segfault while executing trigger
Date: 2019-11-05 12:11:02
Message-ID: 16095-c3ff2e5283b8dba5@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: 16095
Logged by: Thomas Butz
Email address: tbutz(at)optitool(dot)de
PostgreSQL version: 12.0
Operating system: Modified postgres:12 docker image (Debian Buster)
Description:

Postgres package version: 12.0-2.pgdg100+1

I'm trying to setup Nominatim and the import seems to consistently fail
while updating a table because a postgres process terminates with a
segfault.
(discussion: https://github.com/openstreetmap/Nominatim/issues/1551)

So far i was able to obtain a coredump and analyze it with gdb:

# gdb -q -c /tmp/core.postgres.1572952590
/usr/lib/postgresql/12/bin/postgres
Reading symbols from /usr/lib/postgresql/12/bin/postgres...Reading symbols
from
/usr/lib/debug/.build-id/e3/1f64b70ce618d5c59b5485a32deeceb0264254.debug...done.
done.
[New LWP 581]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `postgres:'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000560fcc7e0013 in GetMemoryChunkContext (pointer=0x0) at
./build/../src/include/utils/memutils.h:127
127 ./build/../src/include/utils/memutils.h: No such file or
directory.
(gdb) bt
#0 0x0000560fcc7e0013 in GetMemoryChunkContext (pointer=0x0) at
./build/../src/include/utils/memutils.h:127
#1 pfree (pointer=0x0) at ./build/../src/backend/utils/mmgr/mcxt.c:1033
#2 0x0000560fcc381a35 in heap_freetuple (htup=<optimized out>) at
./build/../src/backend/access/common/heaptuple.c:1340
#3 0x0000560fcc52fe69 in tts_buffer_heap_clear (slot=0x560fce8d8ff0) at
./build/../src/backend/executor/execTuples.c:652
#4 0x0000560fcc53022e in ExecClearTuple (slot=0x560fce8d8ff0) at
./build/../src/include/executor/tuptable.h:428
#5 ExecResetTupleTable (tupleTable=0x560fcdd30d28, shouldFree=false) at
./build/../src/backend/executor/execTuples.c:1165
#6 0x0000560fcc526171 in ExecEndPlan (estate=0x560fcdd2efd0,
planstate=<optimized out>) at
./build/../src/backend/executor/execMain.c:1560
#7 standard_ExecutorEnd (queryDesc=0x560fcdd17b50) at
./build/../src/backend/executor/execMain.c:496
#8 0x0000560fcc55b3f3 in _SPI_pquery (tcount=<optimized out>,
fire_triggers=<optimized out>, queryDesc=<optimized out>) at
./build/../src/backend/executor/spi.c:2533
#9 _SPI_execute_plan (plan=plan(at)entry=0x560fce495920,
paramLI=paramLI(at)entry=0x560fce4a6d50, snapshot=snapshot(at)entry=0x0,
crosscheck_snapshot=crosscheck_snapshot(at)entry=0x0,
read_only=read_only(at)entry=false,
fire_triggers=fire_triggers(at)entry=true, tcount=<optimized out>) at
./build/../src/backend/executor/spi.c:2296
#10 0x0000560fcc55bb14 in SPI_execute_plan_with_paramlist
(plan=0x560fce495920, params=0x560fce4a6d50, read_only=<optimized out>,
tcount=0) at ./build/../src/backend/executor/spi.c:577
#11 0x00007efce42193b4 in exec_stmt_execsql
(estate=estate(at)entry=0x7ffff7444e00, stmt=stmt(at)entry=0x7efce41a4278) at
./build/../src/pl/plpgsql/src/pl_exec.c:4162
#12 0x00007efce421a0eb in exec_stmt (estate=estate(at)entry=0x7ffff7444e00,
stmt=0x7efce41a4278) at ./build/../src/pl/plpgsql/src/pl_exec.c:2033
#13 0x00007efce421d294 in exec_stmts (estate=0x7ffff7444e00,
stmts=<optimized out>) at ./build/../src/pl/plpgsql/src/pl_exec.c:1924
#14 0x00007efce421da98 in exec_for_query
(estate=estate(at)entry=0x7ffff7444e00, stmt=stmt(at)entry=0x7efce41a2a00,
portal=0x560fcd6cee30, prefetch_ok=prefetch_ok(at)entry=true) at
./build/../src/pl/plpgsql/src/pl_exec.c:6007
#15 0x00007efce421a756 in exec_stmt_fors (stmt=0x7efce41a2a00,
estate=0x7ffff7444e00) at ./build/../src/pl/plpgsql/src/pl_exec.c:2791
#16 exec_stmt (estate=estate(at)entry=0x7ffff7444e00, stmt=0x7efce41a2a00) at
./build/../src/pl/plpgsql/src/pl_exec.c:1997
#17 0x00007efce421d294 in exec_stmts (estate=0x7ffff7444e00,
stmts=<optimized out>) at ./build/../src/pl/plpgsql/src/pl_exec.c:1924
#18 0x00007efce421c020 in exec_stmt_if (stmt=0x7efce41a4a88,
estate=0x7ffff7444e00) at ./build/../src/pl/plpgsql/src/pl_exec.c:2474
#19 exec_stmt (estate=estate(at)entry=0x7ffff7444e00, stmt=0x7efce41a4a88) at
./build/../src/pl/plpgsql/src/pl_exec.c:1977
#20 0x00007efce421d294 in exec_stmts (estate=0x7ffff7444e00,
stmts=<optimized out>) at ./build/../src/pl/plpgsql/src/pl_exec.c:1924
#21 0x00007efce421c020 in exec_stmt_if (stmt=0x7efce41a8160,
estate=0x7ffff7444e00) at ./build/../src/pl/plpgsql/src/pl_exec.c:2474
#22 exec_stmt (estate=estate(at)entry=0x7ffff7444e00, stmt=0x7efce41a8160) at
./build/../src/pl/plpgsql/src/pl_exec.c:1977
#23 0x00007efce421d294 in exec_stmts (estate=0x7ffff7444e00,
stmts=<optimized out>) at ./build/../src/pl/plpgsql/src/pl_exec.c:1924
#24 0x00007efce421d65a in exec_stmt_block
(estate=estate(at)entry=0x7ffff7444e00, block=block(at)entry=0x7efce41b58a0) at
./build/../src/pl/plpgsql/src/pl_exec.c:1865
#25 0x00007efce421ae8b in exec_stmt (estate=estate(at)entry=0x7ffff7444e00,
stmt=0x7efce41b58a0) at ./build/../src/pl/plpgsql/src/pl_exec.c:1957
#26 0x00007efce421de36 in plpgsql_exec_trigger
(func=func(at)entry=0x560fcd691238, trigdata=0x7ffff7445240) at
./build/../src/pl/plpgsql/src/pl_exec.c:1005
#27 0x00007efce420fbc4 in plpgsql_call_handler (fcinfo=0x7ffff74450c0) at
./build/../src/pl/plpgsql/src/pl_handler.c:258
#28 0x0000560fcc4ff087 in ExecCallTriggerFunc
(trigdata=trigdata(at)entry=0x7ffff7445240, tgindx=tgindx(at)entry=2,
finfo=0x560fcdaf25d0, instr=0x0, per_tuple_context=0x560fcdfa4690) at
./build/../src/backend/commands/trigger.c:2432
#29 0x0000560fcc5060cc in ExecBRUpdateTriggers
(estate=estate(at)entry=0x560fcdaf1f00, epqstate=epqstate(at)entry=0x560fcdaf27a8,
relinfo=relinfo(at)entry=0x560fcdaf2170, tupleid=tupleid(at)entry=0x7ffff744540a,

fdw_trigtuple=fdw_trigtuple(at)entry=0x0,
newslot=newslot(at)entry=0x560fcd833e10) at
./build/../src/backend/commands/trigger.c:3093
#30 0x0000560fcc54a57d in ExecUpdate (mtstate=mtstate(at)entry=0x560fcdaf26b0,
tupleid=0x7ffff744540a, oldtuple=0x0, slot=0x560fcd833e10,
planSlot=0x560fcd833bd0, epqstate=epqstate(at)entry=0x560fcdaf27a8,
estate=0x560fcdaf1f00,
canSetTag=true) at
./build/../src/backend/executor/nodeModifyTable.c:1072
#31 0x0000560fcc54ba52 in ExecModifyTable (pstate=0x560fcdaf26b0) at
./build/../src/backend/executor/nodeModifyTable.c:2223
#32 0x0000560fcc524983 in ExecProcNode (node=0x560fcdaf26b0) at
./build/../src/include/executor/executor.h:239
#33 ExecutePlan (execute_once=<optimized out>, dest=0x560fcca2ec00
<donothingDR>, direction=<optimized out>, numberTuples=0,
sendTuples=<optimized out>, operation=CMD_UPDATE,
use_parallel_mode=<optimized out>,
planstate=0x560fcdaf26b0, estate=0x560fcdaf1f00) at
./build/../src/backend/executor/execMain.c:1646
#34 standard_ExecutorRun (queryDesc=0x560fcd75a240, direction=<optimized
out>, count=0, execute_once=<optimized out>) at
./build/../src/backend/executor/execMain.c:364
#35 0x0000560fcc68b437 in ProcessQuery (plan=<optimized out>,
sourceText=0x560fcd75a140 "update placex set indexed_status = 0 where
place_id = $1", params=0x560fcd75a1b0, queryEnv=0x0, dest=0x560fcca2ec00
<donothingDR>,
completionTag=0x7ffff74459c0 "") at
./build/../src/backend/tcop/pquery.c:161
#36 0x0000560fcc68b66b in PortalRunMulti
(portal=portal(at)entry=0x560fcd6ced20, isTopLevel=isTopLevel(at)entry=true,
setHoldSnapshot=setHoldSnapshot(at)entry=false, dest=0x560fcca2ec00
<donothingDR>, dest(at)entry=0x560fcd65d270,
altdest=0x560fcca2ec00 <donothingDR>, altdest(at)entry=0x560fcd65d270,
completionTag=completionTag(at)entry=0x7ffff74459c0 "") at
./build/../src/backend/tcop/pquery.c:1283
#37 0x0000560fcc68c25f in PortalRun (portal=portal(at)entry=0x560fcd6ced20,
count=count(at)entry=9223372036854775807, isTopLevel=isTopLevel(at)entry=true,
run_once=run_once(at)entry=true, dest=dest(at)entry=0x560fcd65d270,
altdest=altdest(at)entry=0x560fcd65d270, completionTag=0x7ffff74459c0 "")
at ./build/../src/backend/tcop/pquery.c:796
#38 0x0000560fcc68975e in exec_execute_message
(max_rows=9223372036854775807, portal_name=0x560fcd65ce60 "") at
./build/../src/backend/tcop/postgres.c:2090
#39 PostgresMain (argc=<optimized out>, argv=argv(at)entry=0x560fcd687b38,
dbname=<optimized out>, username=<optimized out>) at
./build/../src/backend/tcop/postgres.c:4297
#40 0x0000560fcc60f579 in BackendRun (port=0x560fcd681d70,
port=0x560fcd681d70) at
./build/../src/backend/postmaster/postmaster.c:4431
#41 BackendStartup (port=0x560fcd681d70) at
./build/../src/backend/postmaster/postmaster.c:4122
#42 ServerLoop () at ./build/../src/backend/postmaster/postmaster.c:1704
#43 0x0000560fcc61049f in PostmasterMain (argc=1, argv=0x560fcd652e60) at
./build/../src/backend/postmaster/postmaster.c:1377
#44 0x0000560fcc377ebd in main (argc=1, argv=0x560fcd652e60) at
./build/../src/backend/main/main.c:228

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Euler Taveira 2019-11-05 15:21:21 Re: Logical replication can be broken by domain constraint with NOT VALID option
Previous Message Marcin CieĊ›lak 2019-11-05 07:21:21 [PATCH] 32x32 and 48x48 favicons