yugabyte / yugabyte-db

YugabyteDB - the cloud native distributed SQL database for mission-critical applications.
https://www.yugabyte.com
Other
8.93k stars 1.06k forks source link

[YSQL][PostGIS] Segmentation fault in ST_MinimumBoundingRadius() #11322

Open def- opened 2 years ago

def- commented 2 years ago

Jira Link: DB-1074

Description

See https://docs.yugabyte.com/latest/api/ysql/extensions/#postgis for PostGIS installation instructions.

Can be reproduced against yugabyte-2.11.2.0 on CentOS using https://github.com/def-/postgis/tree/stable-3.1/regress by running PATH=$CWD/bin/:$PATH ./run_test.pl core/minimum_bounding_circle.sql

tserver log:

2022-02-01 09:17:32.821 UTC [4020] LOG:  server process (PID 4280) was terminated by signal 11: Segmentation fault
2022-02-01 09:17:32.821 UTC [4020] DETAIL:  Failed process was running: SELECT 't4', ST_SRID(center) = 326
11 FROM ST_MinimumBoundingRadius('SRID=32611;POINT(4021690.58034526 6040138.01373556)');

backtrace from gdb:

#0  HeapTupleHeaderGetDatum (tuple=0x0) at ../../../../../../src/postgres/src/backend/executor/execTuples.c:1385
#1  0x00007fa9576aa28e in ST_MinimumBoundingRadius () from /nfusr/dev-server/dfelsing/yugabyte-2.11.2.0/postgres/lib/postgis-3.so
#2  0x00000000006da32c in ExecMakeTableFunctionResult (setexpr=0x38d6568, econtext=0x38d6438, argContext=<optimized out>, expectedDesc=0x38d7618, randomAccess=false)
    at ../../../../../../src/postgres/src/backend/executor/execSRF.c:231
#3  0x00000000006e9a60 in FunctionNext (node=node@entry=0x38d6328) at ../../../../../../src/postgres/src/backend/executor/nodeFunctionscan.c:94
#4  0x00000000006d94aa in ExecScanFetch (recheckMtd=0x6e9770 <FunctionRecheck>, accessMtd=0x6e97a0 <FunctionNext>, node=0x38d6328) at ../../../../../../src/postgres/src/backend/executor/execScan.c:95
#5  ExecScan (node=0x38d6328, accessMtd=0x6e97a0 <FunctionNext>, recheckMtd=0x6e9770 <FunctionRecheck>) at ../../../../../../src/postgres/src/backend/executor/execScan.c:171
#6  0x00000000006ce5db in ExecProcNode (node=0x38d6328) at ../../../../../../src/postgres/src/include/executor/executor.h:249
#7  ExecutePlan (execute_once=<optimized out>, dest=0x38d2978, direction=<optimized out>, numberTuples=0, sendTuples=<optimized out>, operation=CMD_SELECT, use_parallel_mode=<optimized out>, planstate=0x38d6328,
    estate=0x38d6118) at ../../../../../../src/postgres/src/backend/executor/execMain.c:1730
#8  standard_ExecutorRun (queryDesc=0x335f118, direction=<optimized out>, count=0, execute_once=<optimized out>) at ../../../../../../src/postgres/src/backend/executor/execMain.c:367
#9  0x00007fa96624d8bd in pgss_ExecutorRun (queryDesc=0x335f118, direction=ForwardScanDirection, count=0, execute_once=<optimized out>)
    at ../../../../../src/postgres/contrib/pg_stat_statements/pg_stat_statements.c:947
#10 0x00007fa9660463aa in ybpgm_ExecutorRun (queryDesc=0x335f118, direction=ForwardScanDirection, count=0, execute_once=<optimized out>) at ../../../../../src/postgres/contrib/yb_pg_metrics/yb_pg_metrics.c:499
#11 0x000000000088564b in PortalRunSelect (portal=portal@entry=0x365e118, forward=forward@entry=true, count=0, count@entry=9223372036854775807, dest=dest@entry=0x38d2978)
    at ../../../../../../src/postgres/src/backend/tcop/pquery.c:955
#12 0x0000000000887141 in PortalRun (portal=portal@entry=0x365e118, count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=true, run_once=run_once@entry=true, dest=dest@entry=0x38d2978,
    altdest=altdest@entry=0x38d2978, completionTag=0x7ffc0fa760e0 "") at ../../../../../../src/postgres/src/backend/tcop/pquery.c:784
#13 0x0000000000884ad8 in exec_simple_query (query_string=0x358a118 "SELECT 't4', ST_SRID(center) = 32611 FROM ST_MinimumBoundingRadius('SRID=32611;POINT(4021690.58034526 6040138.01373556)');",
    query_string@entry=0x7ffc0fa76060 "\030\341e\003") at ../../../../../../src/postgres/src/backend/tcop/postgres.c:1161
#14 yb_exec_simple_query_impl (query_string=query_string@entry=0x358a118) at ../../../../../../src/postgres/src/backend/tcop/postgres.c:4434
#15 0x000000000087f8b8 in yb_exec_query_wrapper (exec_context=exec_context@entry=0x358a000, restart_data=restart_data@entry=0x7ffc0fa762b0, functor=functor@entry=0x884620 <yb_exec_simple_query_impl>,
    functor_context=functor_context@entry=0x358a118) at ../../../../../../src/postgres/src/backend/tcop/postgres.c:4419
#16 0x00000000008802ec in yb_exec_simple_query (
    query_string=query_string@entry=0x358a118 "SELECT 't4', ST_SRID(center) = 32611 FROM ST_MinimumBoundingRadius('SRID=32611;POINT(4021690.58034526 6040138.01373556)');",
    exec_context=exec_context@entry=0x358a000) at ../../../../../../src/postgres/src/backend/tcop/postgres.c:4449
#17 0x0000000000882213 in PostgresMain (argc=<optimized out>, argv=argv@entry=0x35cc058, dbname=0x35cbf38 "postgis_reg", username=0x3585fe8 "yugabyte")
    at ../../../../../../src/postgres/src/backend/tcop/postgres.c:5084
#18 0x000000000049e292 in BackendRun (port=0x3474960) at ../../../../../../src/postgres/src/backend/postmaster/postmaster.c:4470
#19 BackendStartup (port=0x3474960) at ../../../../../../src/postgres/src/backend/postmaster/postmaster.c:4136
#20 ServerLoop () at ../../../../../../src/postgres/src/backend/postmaster/postmaster.c:1754
#21 0x00000000007ea21f in PostmasterMain (argc=argc@entry=23, argv=argv@entry=0x334e000) at ../../../../../../src/postgres/src/backend/postmaster/postmaster.c:1417
#22 0x000000000073588a in PostgresServerProcessMain (argc=23, argv=0x334e000) at ../../../../../../src/postgres/src/backend/main/main.c:234
#23 0x0000000000735a89 in main ()

Coredump: core.4280.zip

andrei-mart commented 2 years ago

Can not reproduce

yugabyte=# SELECT 't4', ST_SRID(center) = 32611 FROM ST_MinimumBoundingRadius('SRID=32611;POINT(4021690.58034526 6040138.01373556)');
 ?column? | ?column? 
----------+----------
 t4       | t
(1 row)

also see https://github.com/yugabyte/yugabyte-db/issues/11318#issuecomment-1040875605

def- commented 2 years ago

See my comment for full instructions: https://github.com/yugabyte/yugabyte-db/issues/11318#issuecomment-1042798619 Can still reproduce with:

$ PATH=$PWD/bin:/usr/pgsql-11/bin:$PATH POSTGIS_SCRIPTDIR=/usr/pgsql-11/share/contrib/postgis-3.1 ./run_test.pl core/minimum_bounding_circle.sql