osm-without-borders/cosmogony

Segmentation fault

karlwettin opened this issue · 3 comments

I'm getting a segfault when executing on the current weekly OSM planet.pbf (i.e. exported 2021-06-26) using the github master.

No problems when executing on a limited dataset (sweden.pbf from GeoFabrik).

Any suggestions?

I'll try again as soon as the next weekly planet.pbf is released.

[2021-06-30T20:26:00Z INFO  cosmogony_builder::additional_zones] Ignoring place with id node:4295699280 and country relation:2202162 as parent
[2021-06-30T20:26:00Z INFO  cosmogony_builder::additional_zones] Ignoring place with id node:4295699281 and country relation:2202162 as parent
[2021-06-30T20:26:00Z INFO  cosmogony_builder::additional_zones] Ignoring place with id node:4318991429 and country relation:2103120 as parent
[2021-06-30T20:26:03Z INFO  cosmogony_builder::additional_zones] We'll compute voronois partitions for 14005 parent zones
intersection failure: impossible to build a geometry from a nullptr in "Geometry::intersection
Last error: TopologyException: Input geom 0 is invalid: Self-intersection at or near point 11.341666499999999 8.7999999999999989 at 11.341666499999999 8.799999999999998" (Unknown GEOS error)
intersection failure: impossible to build a geometry from a nullptr in "Geometry::intersection
Last error: TopologyException: Input geom 0 is invalid: Self-intersection at or near point 11.341666499999999 8.7999999999999989 at 11.341666499999999 8.799999999999998" (Unknown GEOS error)
intersection failure: impossible to build a geometry from a nullptr in "Geometry::intersection
Last error: TopologyException: Input geom 0 is invalid: Self-intersection at or near point 11.550000000000001 8.3166669999999989 at 11.550000000000001 8.316666999999998" (Unknown GEOS error)

...

extrude_existing_town: difference failed for node:150968654: NoConstructionFromNullPtr("Geometry::difference\nLast error: TopologyException: Input geom 1 is invalid: Nested shells at or near point -121.29731 38.243600000000001 at -121.29731 38.24360000000000")
extrude_existing_town: difference failed for node:29941752: NoConstructionFromNullPtr("Geometry::difference\nLast error: TopologyException: Input geom 1 is invalid: Nested shells at or near point -89.753559199999998 43.144259999999996 at -89.753559199999998 43.14425999999999")
extrude_existing_town: difference failed for node:1178614100: NoConstructionFromNullPtr("Geometry::difference\nLast error: TopologyException: Input geom 1 is invalid: Self-intersection at or near point 133.2864505703993 44.099531000885996 at 133.2864505703993 44.09953100088599")
extrude_existing_town: difference failed for node:1346990699: NoConstructionFromNullPtr("Geometry::difference\nLast error: TopologyException: Input geom 1 is invalid: Self-intersection at or near point 133.2864505703993 44.099531000885996 at 133.2864505703993 44.09953100088599")
extrude_existing_town: difference failed for node:1080033707: NoConstructionFromNullPtr("Geometry::difference\nLast error: TopologyException: Input geom 1 is invalid: Self-intersection at or near point 133.2864505703993 44.099531000885996 at 133.2864505703993 44.09953100088599")

...

Last error: TopologyException: Input geom 0 is invalid: Self-intersection at or near point 4.0499999999999998 7.8749999999999991 at 4.0499999999999998 7.874999999999999" (Unknown GEOS error)
intersection failure: impossible to build a geometry from a nullptr in "Geometry::intersection
Last error: TopologyException: Input geom 0 is invalid: Self-intersection at or near point 4.0499999999999998 7.8749999999999991 at 4.0499999999999998 7.874999999999999" (Unknown GEOS error)
intersection failure: impossible to build a geometry from a nullptr in "Geometry::intersection
Last error: TopologyException: Input geom 0 is invalid: Self-intersection at or near point 3.7916669999999995 7.9249999999999998 at 3.7916669999999995 7.924999999999999" (Unknown GEOS error)
Failed to compute voronoi for parent relation:3720587: impossible to build a geometry from a nullptr in "Geometry::voronoi
Last error: TopologyException: Input geom 1 is invalid: Self-intersection at or near point 4.3749999999999991 7.9499999999999993 at 4.3749999999999991 7.949999999999999"
extrude_existing_town: difference failed for node:150963743: NoConstructionFromNullPtr("Geometry::difference\nLast error: TopologyException: Input geom 1 is invalid: Nested shells at or near point -122.78478179999999 45.340228699999997 at -122.78478179999999 45.34022869999999")
extrude_existing_town: difference failed for node:4571365408: NoConstructionFromNullPtr("Geometry::difference\nLast error: TopologyException: Input geom 1 is invalid: Self-intersection at or near point 107.95787713017623 26.570585016953814 at 107.95787713017623 26.57058501695381")
extrude_existing_town: difference failed for node:4571483306: NoConstructionFromNullPtr("Geometry::difference\nLast error: TopologyException: Input geom 1 is invalid: Self-intersection at or near point 107.95787713017623 26.570585016953814 at 107.95787713017623 26.57058501695381")
Segmentation fault (core dumped)

Thanks for your feedback.

I also noticed that a segmentation fault could occur in some cases. It's probably related to a thread-safety issue in the GEOS binding. But I haven't dug enough into this yet. As the problem seems to occur only when the planet file is used as the input, it will be quite hard to produce a minimal reproducible example.

There is a draft that attempts to make the implementation of voronoi-based cities geometries more robust in #116. This includes a potential workaround for this issue. So you may want to test with this branch.

Alternatively, it's possible to use the flag cosmogony generate --disable-voronoi to disable the step where these voronoi-based polygons are generated. The coverage of cities in the output will be deteriorated though.

This should be fixed with v0.10.2, even though the root cause is still unclear.

Cool, thanks! I'll try it out this weekend and report back.