On Tue, Jul 12, 2022 8:49 AM Masahiko Sawada <sawada.m...@gmail.com> wrote:
> 
> I've attached an updated patch.
> 

Hi,

I met a segmentation fault in test_decoding test after applying the patch for 
master
branch. Attach the backtrace.

It happened when executing the following code because it tried to free a NULL
pointer (catchange_xip).

        /* be tidy */
        if (ondisk)
                pfree(ondisk);
+       if (catchange_xip)
+               pfree(catchange_xip);
 }

It seems to be related to configure option. I could reproduce it when using
`./configure --enable-debug`.
But I couldn't reproduce with `./configure --enable-debug CFLAGS="-Og -ggdb"`.

Regards,
Shi yu
#0  0x0000000000910333 in GetMemoryChunkContext (pointer=0x0) at 
../../../../src/include/utils/memutils.h:129
#1  pfree (pointer=0x0) at mcxt.c:1177
#2  0x000000000078186b in SnapBuildSerialize (builder=0x1fd5e78, lsn=25719712) 
at snapbuild.c:1792
#3  0x0000000000782797 in SnapBuildProcessRunningXacts (builder=0x1fd5e78, 
lsn=25719712, running=0x27dfe50) at snapbuild.c:1199
#4  0x0000000000774273 in standby_decode (ctx=0x1fc3e08, buf=0x7ffd8c95b5d0) at 
decode.c:346
#5  0x0000000000773ab3 in LogicalDecodingProcessRecord 
(ctx=ctx@entry=0x1fc3e08, record=0x1fc41a0) at decode.c:119
#6  0x000000000077815d in pg_logical_slot_get_changes_guts (fcinfo=0x1fb5d88, 
confirm=<optimized out>, binary=<optimized out>) at logicalfuncs.c:271
#7  0x000000000067b63d in ExecMakeTableFunctionResult (setexpr=0x1fb42e0, 
econtext=0x1fb41b0, argContext=<optimized out>, expectedDesc=0x1fd7da8, 
randomAccess=false)
    at execSRF.c:234
#8  0x000000000068b76f in FunctionNext (node=node@entry=0x1fb3fa0) at 
nodeFunctionscan.c:94
#9  0x000000000067be37 in ExecScanFetch (recheckMtd=0x68b450 <FunctionRecheck>, 
accessMtd=0x68b470 <FunctionNext>, node=0x1fb3fa0) at execScan.c:133
#10 ExecScan (node=0x1fb3fa0, accessMtd=0x68b470 <FunctionNext>, 
recheckMtd=0x68b450 <FunctionRecheck>) at execScan.c:199
#11 0x000000000067344b in ExecProcNode (node=0x1fb3fa0) at 
../../../src/include/executor/executor.h:259
#12 ExecutePlan (execute_once=<optimized out>, dest=0x1fc02e8, 
direction=<optimized out>, numberTuples=0, sendTuples=<optimized out>, 
operation=CMD_SELECT,
    use_parallel_mode=<optimized out>, planstate=0x1fb3fa0, estate=0x1fb3d78) 
at execMain.c:1636
#13 standard_ExecutorRun (queryDesc=0x1f9e178, direction=<optimized out>, 
count=0, execute_once=<optimized out>) at execMain.c:363
#14 0x00000000007dda9e in PortalRunSelect (portal=0x1f51338, forward=<optimized 
out>, count=0, dest=<optimized out>) at pquery.c:924
#15 0x00000000007decf7 in PortalRun (portal=portal@entry=0x1f51338, 
count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=true,
    run_once=run_once@entry=true, dest=dest@entry=0x1fc02e8, 
altdest=altdest@entry=0x1fc02e8, qc=0x7ffd8c95bbf0) at pquery.c:768
#16 0x00000000007db4ff in exec_simple_query (
    query_string=0x1ee29a8 "SELECT data FROM 
pg_logical_slot_get_changes('isolation_slot', NULL, NULL, 'skip-empty-xacts', 
'1', 'include-xids', '0');")
    at postgres.c:1243
#17 0x00000000007dc742 in PostgresMain (dbname=<optimized out>, 
username=<optimized out>) at postgres.c:4482
#18 0x000000000076132b in BackendRun (port=<optimized out>, port=<optimized 
out>) at postmaster.c:4503
#19 BackendStartup (port=<optimized out>) at postmaster.c:4231
#20 ServerLoop () at postmaster.c:1805
#21 0x00000000007621fb in PostmasterMain (argc=argc@entry=3, 
argv=argv@entry=0x1edbf20) at postmaster.c:1477
#22 0x00000000004f0f69 in main (argc=3, argv=0x1edbf20) at main.c:202

Reply via email to