Skip to content

[GH-3276] Suppress campskeleton degenerate-collision stderr flooding in StraightSkeleton - #3280

Closed
minhpham1810 wants to merge 1 commit into
apache:masterfrom
minhpham1810:gh-3276-st-straight-skeleton
Closed

minhpham1810 wants to merge 1 commit into
apache:masterfrom
minhpham1810:gh-3276-st-straight-skeleton

Conversation

@minhpham1810

Copy link
Copy Markdown
Contributor

Did you read the Contributor Guide?

Is this PR related to a ticket?

What changes were proposed in this PR?

ST_ApproximateMedialAxis and ST_StraightSkeleton could flood executor logs: the campskeleton library (org.datasyslab:campskeleton, an external jar not vendored in this repo) catches its own internal java.lang.Error: Planes do not intersect at a single point. — raised for degenerate collision events, typically from polygons with many short, near-collinear edges — and prints the full stack trace to System.err instead of failing. A single 557-vertex polygon could print this trace 130-190 times per call, and a batch job skeletonizing a few thousand polygons produced 100k+ traces in a single run, burying real errors.

Since the library itself isn't vendored here, this PR suppresses the flooding from the Sedona side (StraightSkeleton.computeSkeleton): before invoking the library, it installs a process-wide, line-buffering filter on System.err that recognizes and silently drops exactly this known-harmless stack trace (logging one DEBUG-level line per occurrence instead) while passing every other line through unchanged. The filter re-validates on every call via a cheap reference check, so it self-heals if something else replaces System.err, and it avoids holding any lock around the actual (expensive, parallelizable) skeleton computation.

How was this patch tested?

Added StraightSkeletonTest#testDegenerateCollinearPolygonDoesNotFloodStderr, which runs the 557-vertex repro polygon from the issue, captures System.err during the call, and asserts none of campskeleton's degenerate-collision trace lines leak through, while the skeleton output is still produced correctly.

Ran the full StraightSkeletonTest (24/24) and FunctionsTest / raster.FunctionsTest suites (327/327) locally — all pass. Also verified with a standalone harness against the issue's exact repro polygon: before the fix, ~71KB / 130+ suppressed-trace occurrences leaked to stderr; after the fix, 0 bytes leak, with identical skeleton output (1087 edges either way).

Did this PR include necessary documentation updates?

  • No, this PR does not affect any public API so no need to change the documentation.

@minhpham1810
minhpham1810 requested a review from jiayuasu as a code owner August 25, 2026 03:38
@jiayuasu

Copy link
Copy Markdown
Member

Thanks for the detailed analysis in this PR. However, I'd like to fix this at the source instead: org.datasyslab:campskeleton is a fork we control, so the library itself should stop printing rather than Sedona filtering stderr.

I've pushed a fix to the fork (jiayuasu/campskeleton@9b47397), released as 0.0.2-20260823. It routes all diagnostics on the core algorithm path (CoSitedCollision.validateChains, Skeleton.skeleton/validate/findLiveLoop, Output.merge) through java.util.logging at FINE level, so they are silent by default but can still be enabled for debugging.

Closing this in favor of the dependency bump.

@jiayuasu jiayuasu closed this Aug 25, 2026
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

2 participants