Repository navigation
[GH-3548] Fix ST_Force4D thread safety - #3549
Conversation
…4D dimension handling GeometryForce4DTransformer kept hasZ/hasM in static fields, so concurrent calls on geometries with different dimensions overwrote each other's state and returned wrong ordinates (including NaN). The decision is now made per coordinate sequence with no shared state. Also fixed: - ST_Force3DM returned XYZM input unchanged instead of dropping Z. - Geometry collections with mixed dimensions lost existing M values in ST_Force3DM and got NaN Z values in ST_Force4D. Generated-by: AI coding assistants (Gemini, GPT, Claude)
|
Could we keep this PR focused on the The static I compiled this minimal variant against the base revision and ran the new Please retain the concurrency regression test here and move the shared transformer refactor, mixed-dimension/NaN handling, and |
Per review: make hasZ/hasM instance fields set on the per-call transformer, keep the concurrency regression test, and move the shared transformer refactor, mixed-dimension handling and the ST_Force3DM XYZM fix to a follow-up PR. Also rename test variables that the codespell pre-commit hook flagged. Generated-by: AI coding assistants (Gemini, GPT, Claude)
|
Thanks for the review. I've narrowed the PR to the race fix as you suggested: I'll open a separate issue and follow-up PR for the mixed-dimension collection handling and the |
Did you read the Contributor Guide?
Is this PR related to a ticket?
[GH-XXX] my subject. Closes ST_Force4D returns wrong Z/M values under concurrent execution (static state in GeometryForce4DTransformer) #3548What changes were proposed in this PR?
GeometryForce4DTransformerkepthasZ/hasMinprivate staticfields that were set intransform()and read intransformCoordinates(). Concurrent calls on geometries with different dimensions overwrote each other's flags and silently returned wrong ordinates, includingNaN(details and reproducer in #3548).hasZandhasMare now instance fields, set on the transformer that the static entry point already creates for each call, so concurrent calls no longer share state.This PR is limited to the race. The mixed-dimension collection handling and the
ST_Force3DMXYZM case described in #3548 will be handled in a follow-up issue and PR.How was this patch tested?
FunctionsTest.force4DIsThreadSafe: 8 threads alternate between an XYZ and an XYM line. On master it fails (6,692 wrong results out of 160,000 calls on my machine); with this change it passes.FunctionsTestpasses.Did this PR include necessary documentation updates?