#5145 closed defect (fixed)
segfault with select ST_Node(ST_GeomFromText('LINESTRING EMPTY'))
Reported by: | cactusbone | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS GEOS |
Component: | postgis | Version: | 3.2.x |
Keywords: | Cc: |
Description
Using PostGIS docker image 14-3.2-alpine, which ships with postgis 3.2.1 and geos 3.10,
I have a segfault with select ST_Node(ST_GeomFromText('LINESTRING EMPTY'))
here's the core dump backtrace
#0 0x00007f36bc780cc7 in geos::noding::SegmentNodeList::add(geos::geom::Coordinate const&, unsigned long) () from /usr/lib/libgeos.so.3.10.2 #1 0x00007f36bc780dea in geos::noding::SegmentNodeList::addEndpoints() () from /usr/lib/libgeos.so.3.10.2 #2 0x00007f36bc781539 in geos::noding::SegmentNodeList::addSplitEdges(std::vector<geos::noding::SegmentString*, std::allocator<geos::noding::SegmentString*> >&) () from /usr/lib/libgeos.so.3.10.2 #3 0x00007f36bc77c5c4 in geos::noding::NodedSegmentString::getNodedSubstrings(std::vector<geos::noding::SegmentString*, std::allocator<geos::noding::SegmentString*> > const&, std::vector<geos::noding::SegmentString*, std::allocator<geos::noding::SegmentString*> >*) () from /usr/lib/libgeos.so.3.10.2 #4 0x00007f36bc77c661 in geos::noding::NodedSegmentString::getNodedSubstrings(std::vector<geos::noding::SegmentString*, std::allocator<geos::noding::SegmentString*> > const&) () from /usr/lib/libgeos.so.3.10.2 #5 0x00007f36bc778f1c in geos::noding::IteratedNoder::node(std::vector<geos::noding::SegmentString*, std::allocator<geos::noding::SegmentString*> >*, int&, geos::geom::Coordinate&) () from /usr/lib/libgeos.so.3.10.2 #6 0x00007f36bc77900c in geos::noding::IteratedNoder::computeNodes(std::vector<geos::noding::SegmentString*, std::allocator<geos::noding::SegmentString*> >*) () from /usr/lib/libgeos.so.3.10.2 #7 0x00007f36bc777f27 in geos::noding::GeometryNoder::getNoded() () from /usr/lib/libgeos.so.3.10.2 #8 0x00007f36bc778030 in geos::noding::GeometryNoder::node(geos::geom::Geometry const&) () from /usr/lib/libgeos.so.3.10.2 #9 0x00007f36bcd811d7 in GEOSNode_r () from /usr/lib/libgeos_c.so.1 #10 0x00007f36bcc632d0 in lwgeom_node (lwgeom_in=lwgeom_in@entry=0x7f36bcdfbbd8) at lwgeom_geos_node.c:156 #11 0x00007f36bcb6e9bc in ST_Node (fcinfo=0x7f36bcdb8d38) at lwgeom_geos.c:3331 #12 0x000056163af61227 in ExecInterpExpr () #13 0x000056163b024c30 in evaluate_expr () #14 0x000056163b024e81 in simplify_function () #15 0x000056163b025d40 in eval_const_expressions_mutator () #16 0x000056163afcc229 in expression_tree_mutator () #17 0x000056163afcc4ae in expression_tree_mutator () #18 0x000056163b026d5f in eval_const_expressions () #19 0x000056163b00e0b8 in preprocess_expression () #20 0x000056163b0149a3 in subquery_planner () #21 0x000056163b015383 in standard_planner () #22 0x000056163b0cfceb in pg_plan_query () #23 0x000056163b0cfdd1 in pg_plan_queries () #24 0x000056163b0d00a5 in exec_simple_query () #25 0x000056163b0d2035 in PostgresMain () #26 0x000056163b053f73 in ServerLoop () #27 0x000056163b054de1 in PostmasterMain () #28 0x000056163addcbce in main ()
I'm not sure if the bug is in geos OR PostGIS, so I'm opening it in both places See https://github.com/libgeos/geos/issues/601
to reproduce easily:
- start docker container
docker run --rm --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgis/postgis:14-3.2-alpine
(remove-d
to not start in background) - run query using another container
docker run -it --rm --link some-postgres postgres psql postgresql://postgres:mysecretpassword@some-postgres -c "select ST_Node(ST_GeomFromText('LINESTRING EMPTY'))"
2022-05-04 12:16:36.761 UTC [1] LOG: server process (PID 63) was terminated by signal 11: Segmentation fault
2022-05-04 12:16:36.761 UTC [1] DETAIL: Failed process was running: select ST_Node(ST_GeomFromText('LINESTRING EMPTY'))
Change History (6)
comment:1 by , 3 years ago
comment:2 by , 3 years ago
@cactusnode,
Thanks for the update. I still seem to be getting a crash though
In both
POSTGIS="3.2.1 3.2.1" [EXTENSION] PGSQL="140" GEOS="3.10.2-CAPI-1.16.0" PROJ="7.2.1" LIBXML="2.9.9" LIBJSON="0.12" LIBPROTOBUF="1.2.1" WAGYU="0.5.0 (Internal)" PostgreSQL 14.1, compiled by Visual C++ build 1914, 64-bit
and
POSTGIS="3.3.0dev 3.2.0-693-g9870fd492" [EXTENSION] PGSQL="140" GEOS="3.11.0dev-CAPI-1.16.0" PROJ="7.2.1" GDAL="GDAL 3.3.3, released 2021/10/25" LIBXML="2.9.9" LIBJSON="0.12" LIBPROTOBUF="1.2.1" WAGYU="0.5.0 (Internal)" RASTER PostgreSQL 14rc1 on x86_64-w64-mingw32, compiled by gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0, 64-bit
Though what puzzles me is this test should be one that is tested in gardentests so I got to check why that isn't picking this up.
comment:3 by , 3 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Okay I'm going to close this out. It works after I updated my geos to geos main. The 3.10.2 I have it's still broken, so I guess that's because this fix was released only 10 days ago so will be in 3.10.3.
comment:4 by , 3 years ago
Okay I discovered how this got past the garden tests.
The garden test does this:
SELECT ST_Node(foo1.the_geom) As result FROM ((SELECT ST_GeomFromText('POINT EMPTY',4326) As the_geom UNION ALL SELECT ST_GeomFromText('LINESTRING EMPTY',4326) As the_geom UNION ALL SELECT ST_GeomFromText('MULTILINESTRING EMPTY',4326) As the_geom ) ) As foo1 LIMIT 10;
Which errors out before it gets to the noding part, with this error:
ERROR: Noding geometries of dimension != 1 is unsupported
So I guess I need to add some tests that have these as standalone as well.
This is now fixed in geos not sure if there are more work to do here