Skip to content

[GH-3276] Stop straight skeleton from flooding stderr on rasterised outlines - #3285

Merged
jiayuasu merged 3 commits into
apache:masterfrom
jiayuasu:fix/skeleton-stderr-flood
Aug 25, 2026
Merged

jiayuasu merged 3 commits into
apache:masterfrom
jiayuasu:fix/skeleton-stderr-flood

Conversation

@jiayuasu

@jiayuasu jiayuasu commented Aug 25, 2026 •

Copy link
Copy Markdown
Member

Did you read the Contributor Guide?

Is this PR related to a ticket?

What changes were proposed in this PR?

Polygons with many short, near-collinear edges (outlines traced from raster pixels, ST_SubDivide pieces) trigger degenerate collision events inside campskeleton. The library caught the resulting java.lang.Error: Planes do not intersect at a single point internally and printed the full stack trace to stderr for every event: 130-190 traces per call for the 557-vertex polygon in the issue, hundreds of thousands for a job over a few thousand polygons. The call still returned a result, so nothing signalled a problem except the log volume.

This bumps campskeleton to 0.0.2-20260823 (jiayuasu/campskeleton#3), which fixes this at the source:

  • The known degenerate condition is now a dedicated SingularPlanesError logged via java.util.logging at FINE level (silent by default, can be enabled for debugging).
  • Any other unexpected failure during event processing still logs at WARNING with its stack trace, so real problems remain visible.
  • The algorithm is unchanged: the degenerate event is skipped exactly as in every previous release. Restoring the pre-fork RuntimeException semantics (which would re-enable the library's parallel-edge fallbacks) was evaluated and rejected because it measurably degraded skeletons on rasterised outlines (edges far outside the input polygon, crossing arcs).

Also adds a note to the ST_StraightSkeleton / ST_ApproximateMedialAxis doc pages (sql, flink, snowflake) that such inputs should be simplified first, e.g. with ST_SimplifyPreserveTopology, since the skeleton quality around near-collinear edges is degraded regardless of logging.

How was this patch tested?

  • New regression test StraightSkeletonTest#rasterizedOutlineWritesNothingToStderr: runs ST_StraightSkeleton and ST_ApproximateMedialAxis with System.err captured, and asserts nothing is written while both calls still produce non-empty results. The input is a 10-vertex fragment of the 557-vertex repro polygon from the issue, minimised while preserving the trigger: against campskeleton 0.0.2-20260118 every skeleton computation deterministically prints three degenerate-collision traces (six across the test's two calls, verified across fresh JVMs and with -ea), so the test fails there and passes with 0.0.2-20260823.
  • Full StraightSkeletonTest suite (24/24) passes with the dependency resolved fresh from Maven Central.
  • Output parity was checked over repeated runs on the repro polygon and a 30-polygon rasterised-outline benchmark: edge counts and total lengths match the previous release run-for-run, and stderr stays at 0 bytes (with and without -ea).

Did this PR include necessary documentation updates?

  • Yes, I have updated the documentation.

…ised outlines

Polygons with many short, near-collinear edges (outlines traced from raster
pixels, ST_SubDivide pieces) trigger degenerate collision events inside
campskeleton. The library caught the resulting Error internally and printed
the full stack trace to stderr for every event: 130-190 traces per call for
a 557-vertex polygon, hundreds of thousands for a job over a few thousand
polygons. The call still returned a result.

Bump campskeleton to 0.0.2-20260823, which routes these diagnostics through
java.util.logging at FINE level instead of stderr. The algorithm is
unchanged: the degenerate event is still skipped exactly as before.

Add a regression test that runs ST_StraightSkeleton and
ST_ApproximateMedialAxis on the polygon from the report with System.err
captured and asserts nothing is written. Document in the function pages
that such inputs should be simplified first.
@jiayuasu
jiayuasu marked this pull request as draft August 25, 2026 21:07
The 557-vertex polygon from the issue triggered the degenerate traces a
varying 130-190 times per call. Delta-debugging it down to a 10-vertex
fragment preserves the trigger and makes it deterministic: with
campskeleton 0.0.2-20260118 it prints exactly six traces on every run,
across fresh JVMs and with assertions enabled. The fragment is short
enough to inline, so the test resource file is no longer needed.
The fixture emits three traces per skeleton computation on campskeleton
0.0.2-20260118; the test captures six because it runs two computations.
@jiayuasu
jiayuasu marked this pull request as ready for review August 25, 2026 22:58
@jiayuasu jiayuasu added this to the sedona-2.0.0 milestone Aug 25, 2026
@jiayuasu
jiayuasu merged commit 25840b3 into apache:master Aug 25, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ST_ApproximateMedialAxis and ST_StraightSkeleton flood stderr with 'Planes do not intersect at a single point' traces

1 participant