Re: BUG #16036: Segmentation fault while doing an update

Антон Власов <druidvav@gmail.com>

From: Антон Власов <druidvav@gmail.com>
To: Антон Власов <druidvav@gmail.com>, pgsql-bugs@lists.postgresql.org
Date: 2019-10-04T00:55:49Z
Lists: pgsql-bugs
Got normal backtrace:

#0  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  0x0000564c3f007aca in heap_freetuple (htup=<optimized out>) at ./build/../src/backend/access/common/heaptuple.c:1340
#3  0x0000564c3f1b5889 in tts_buffer_heap_clear (slot=0x564c40650298) at ./build/../src/backend/executor/execTuples.c:652
#4  0x0000564c3f1b5cbe in ExecClearTuple (slot=0x564c40650298) at ./build/../src/include/executor/tuptable.h:428
#5  ExecResetTupleTable (tupleTable=0x564c4068a6b0, shouldFree=false) at ./build/../src/backend/executor/execTuples.c:1165
#6  0x0000564c3f1abc40 in ExecEndPlan (estate=0x564c40689740, planstate=<optimized out>) at ./build/../src/backend/executor/execMain.c:1560
#7  standard_ExecutorEnd (queryDesc=0x564c40663d80) at ./build/../src/backend/executor/execMain.c:496
#8  0x0000564c3f30a6e8 in ProcessQuery (plan=<optimized out>, sourceText=0x564c40663c60 "update tracking.test_session set list_position = list_position + 1 where id = $1", params=0x564c40663cf0, queryEnv=0x0, dest=0x564c3f8b1c00 <donothingDR>,
    completionTag=0x7ffd3557c720 "UPDATE 0") at ./build/../src/backend/tcop/pquery.c:204
#9  0x0000564c3f30a8c3 in PortalRunMulti (portal=portal@entry=0x564c405cb3b0, isTopLevel=isTopLevel@entry=true, setHoldSnapshot=setHoldSnapshot@entry=false, dest=0x564c3f8b1c00 <donothingDR>, dest@entry=0x564c4052dc90, altdest=0x564c3f8b1c00 <donothingDR>,
    altdest@entry=0x564c4052dc90, completionTag=completionTag@entry=0x7ffd3557c720 "UPDATE 0") at ./build/../src/backend/tcop/pquery.c:1283
#10 0x0000564c3f30b4db in PortalRun (portal=portal@entry=0x564c405cb3b0, count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=true, run_once=<optimized out>, dest=dest@entry=0x564c4052dc90, altdest=altdest@entry=0x564c4052dc90,
    completionTag=0x7ffd3557c720 "UPDATE 0") at ./build/../src/backend/tcop/pquery.c:796
#11 0x0000564c3f308d05 in exec_execute_message (max_rows=9223372036854775807, portal_name=0x564c4052d880 "") at ./build/../src/backend/tcop/postgres.c:2090
#12 PostgresMain (argc=<optimized out>, argv=argv@entry=0x564c40578e80, dbname=<optimized out>, username=<optimized out>) at ./build/../src/backend/tcop/postgres.c:4297
#13 0x0000564c3effcbe1 in BackendRun (port=0x564c40574ba0, port=0x564c40574ba0) at ./build/../src/backend/postmaster/postmaster.c:4431
#14 BackendStartup (port=0x564c40574ba0) at ./build/../src/backend/postmaster/postmaster.c:4122
#15 ServerLoop () at ./build/../src/backend/postmaster/postmaster.c:1704
#16 0x0000564c3f28fe81 in PostmasterMain (argc=5, argv=0x564c40524b70) at ./build/../src/backend/postmaster/postmaster.c:1377
#17 0x0000564c3effdea8 in main (argc=5, argv=0x564c40524b70) at ./build/../src/backend/main/main.c:228

> 4 окт. 2019 г., в 3:29, PG Bug reporting form <noreply@postgresql.org> написал(а):
> 
> The following bug has been logged on the website:
> 
> Bug reference:      16036
> Logged by:          Антон Власов
> Email address:      druidvav@gmail.com
> PostgreSQL version: 12.0
> Operating system:   PostgreSQL 12.0 (Debian 12.0-1.pgdg90+1) on x86_64
> Description:        
> 
> I am having segmentation fault like this:
> 
> 2019-10-04 02:30:02 MSK [16919-6] LOG:  server process (PID 18415) was
> terminated by signal 11: Segmentation fault
> 2019-10-04 02:30:02 MSK [16919-7] DETAIL:  Failed process was running:
> update tracking.test_session set list_position = list_position + 1 where id
> = $1
> 2019-10-04 02:30:02 MSK [16919-8] LOG:  terminating any other active server
> processes
> 
> When there are several queries running simultaneously. Tried to get some
> info from coredump, but that's all i have:
> 
> (gdb) bt
> #0  GetMemoryChunkContext (pointer=0x0) at
> ./build/../src/include/utils/memutils.h:127
> #1  pfree (pointer=0x0) at ./build/../src/backend/utils/mmgr/mcxt.c:1033
> Backtrace stopped: Cannot access memory at address 0x7ffc990e7218
> 




Commits

  1. Disable one more set of tests from c8841199509.

  2. Disable one set of tests from c8841199509.

  3. Add isolation tests for the combination of EPQ and triggers.

  4. Fix crash caused by EPQ happening with a before update trigger present.

  5. Modify the isolation tester so that multiple sessions can wait.