Opened 3 years ago

Closed 3 years ago

#4883 closed defect (fixed)

Topology crash on PostgreSQL 14 mingw windows - sqlmm

Reported by: robe Owned by: strk
Priority: blocker Milestone: PostGIS PostgreSQL
Component: topology Version: master
Keywords: Cc:

Description

I sent this upstream as they are having trouble replicating mingw issues and there are ton of tests failing on some mingw64 bots (not all).

https://www.postgresql.org/message-id/002001d7175f%248942b020%249bc81060%24%40pcorp.us

Crash happens here:

SELECT topology.ST_AddIsoEdge('sqlmm_topology', 1, 2, 'LINESTRING(0 0, 10 0, 5 5, 5 -5)');

stack trace below:

Thread 1 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 22272.0x49ec]
0x00007ffe75f5f23f in ntdll!RtlLeaveCriticalSection ()
   from C:\WINDOWS\SYSTEM32\ntdll.dll
(gdb) bt
#0  0x00007ffe75f5f23f in ntdll!RtlLeaveCriticalSection ()
   from C:\WINDOWS\SYSTEM32\ntdll.dll
#1  0x00007ffe75fd4c0e in ntdll!memset () from C:\WINDOWS\SYSTEM32\ntdll.dll
#2  0x00007ffe75fbc872 in ntdll!__C_specific_handler ()
   from C:\WINDOWS\SYSTEM32\ntdll.dll
#3  0x00007ffe75fd1fef in ntdll!.chkstk () from
C:\WINDOWS\SYSTEM32\ntdll.dll
#4  0x00007ffe75f60939 in ntdll!RtlUnwindEx ()
   from C:\WINDOWS\SYSTEM32\ntdll.dll
#5  0x00007ffe74002eed in msvcrt!_setjmpex ()
   from C:\WINDOWS\System32\msvcrt.dll
#6  0x00000000008d929a in pg_re_throw () at elog.c:1776
#7  0x00000000008d911d in errfinish (filename=<optimized out>,
    lineno=<optimized out>, funcname=0x6b025560 <__func__.114531>
"pg_error")
    at elog.c:589
#8  0x000000006afc91d3 in pg_error (fmt=<optimized out>, ap=<optimized out>)
    at lwgeom_pg.c:250
#9  0x000000006afdfb03 in lwerror (fmt=0x0) at lwutil.c:197
#10 0x000000006b000c16 in lwt_AddIsoEdge (topo=topo(at)entry=0x83629b0,
    startNode=startNode(at)entry=1, endNode=endNode(at)entry=2,
    geom=geom(at)entry=0x7a303b8) at lwgeom_topo.c:794
#11 0x000000006afc70d2 in ST_AddIsoEdge (fcinfo=0x7a2caa8)
    at postgis_topology.c:3567
#12 0x00000000005f7604 in ExecInterpExpr (state=0x7a2c9c0,
    econtext=0x7a2c6c0, isnull=<optimized out>) at execExprInterp.c:1209
#13 0x000000000062f23f in ExecEvalExprSwitchContext (isNull=0x509ef9f,
    econtext=0x7a2c6c0, state=0x7a2c9c0)
    at ../../../src/include/executor/executor.h:315
#14 ExecProject (projInfo=0x7a2c9b8)
    at ../../../src/include/executor/executor.h:349
#15 ExecResult (pstate=<optimized out>) at nodeResult.c:136
#16 0x00000000005fc0ca in ExecProcNode (node=0x7a2c5a8)
    at ../../../src/include/executor/executor.h:247
#17 ExecutePlan (execute_once=<optimized out>, dest=0x7a2b2e8,
    direction=<optimized out>, numberTuples=0, sendTuples=<optimized out>,
    operation=CMD_SELECT, use_parallel_mode=<optimized out>,
    planstate=0x7a2c5a8, estate=0x7a2c370) at execMain.c:1531
#18 standard_ExecutorRun (queryDesc=0x8338990, direction=<optimized out>,
    count=0, execute_once=<optimized out>) at execMain.c:350
#19 0x00000000007a08cb in PortalRunSelect (portal=0x79bcc70,
    portal(at)entry=0x7fffffff, forward=forward(at)entry=true,
count=count(at)entry=0,
    dest=dest(at)entry=0x7a2b2e8) at pquery.c:912
#20 0x00000000007a20cc in PortalRun (portal=0x7fffffff,
    portal(at)entry=0x79bcc70, count=0, count(at)entry=2147483647,
    isTopLevel=isTopLevel(at)entry=true, run_once=run_once(at)entry=true,
    dest=dest(at)entry=0x7a2b2e8, altdest=altdest(at)entry=0x7a2b2e8,
    qc=qc(at)entry=0x509f2d0) at pquery.c:756
#21 0x000000000079d6ab in exec_simple_query (
    query_string=0x79fd1e0 "SELECT topology.ST_AddIsoEdge('sqlmm_topology',
1, 2, 'LINESTRING(0 0, 10 0, 5 5, 5 -5)');") at postgres.c:1173
#22 0x000000000079ee40 in PostgresMain (argc=argc(at)entry=1,
    argv=argv(at)entry=0x509f980, dbname=<optimized out>,
    username=<optimized out>) at postgres.c:4327
#23 0x0000000000708608 in BackendRun (port=0x509f7c0, port=0x509f7c0)
    at postmaster.c:4464
#24 SubPostmasterMain (argc=argc(at)entry=3, argv=argv(at)entry=0x5176af0)
    at postmaster.c:4977
#25 0x000000000093cb13 in main (argc=3, argv=0x5176af0) at main.c:186


Change History (5)

comment:1 by robe, 3 years ago

Component: postgistopology
Owner: changed from pramsey to strk

comment:2 by robe, 3 years ago

Okay I just repulled and recompiled without cassert and the error does not happen then. I'm going to retest with cassert again to rule out they made a change upstream.

comment:3 by robe, 3 years ago

turning cassert off also seemed to make all the postgres regress checks pass too. Retesting now with cassert enabled again to rule out that they just fixed some things.

comment:4 by robe, 3 years ago

I'm looking at the crashers in postgresql proper. The first one I came across copyselect, crashes in same place as I noted here - https://www.postgresql.org/message-id/000201d71781%24a0c5da20%24e2518e60%24%40pcorp.us

elog.c:1776

#3  0x00000000008da31a in pg_re_throw () at elog.c:1776
#4  0x00000000008da19d in errfinish (filename=<optimized out>,
    filename(at)entry=0xa291a0 <BinarySignature+24> "copyto.c",
    lineno=lineno(at)entry=490,
    funcname=funcname(at)entry=0xa29980 <__func__.112127> "BeginCopyTo")
    at elog.c:589
    at elog.c:589

So don't think topology is at fault here and just the way certain errors are being handled.

comment:5 by robe, 3 years ago

Milestone: PostGIS 3.2.0PostGIS PostgreSQL
Resolution: fixed
Status: newclosed

I tested Tom Lane's patch that fixed the issue so closing this out as it will be committed I think to PG14.

https://www.postgresql.org/message-id/000d01d71869%242dabde70%2489039b50%24%40pcorp.us

Note: See TracTickets for help on using tickets.