Skip to content

Test failures in parallel thin_plate_spline tests #8212

Open

Description

@matthew-brett

Description:

Notice current test failure at https://github.com/matthew-brett/scikit-image/actions/runs/26818776702/job/79067833098

This appears to be due to variability in the output from Scipy, when running in parallel threads.

Below is Cursor's analysis:

What the failure actually shows

  • Only fails on Python 3.14 free-threaded with pytest-run-parallel --parallel-threads=4
  • Passes on local 3.12
  • In the failing test, from_estimate + warp succeeds, then estimate + warp fails
  • Both paths call the same _estimate implementation:

  # from_estimate
  tf = cls()
  tf._estimate(src, dst)
  # estimate (deprecated)
  return self._estimate(src, dst) is None

  Locally, those produce identical _spline_mappings and identical warp output.

  So this doesn't look like a logic bug in “estimation vs from_estimate.” It looks like
  environment- or timing-sensitive behavior on 3.14t under parallel test execution.

Way to reproduce:

No response

Version information:

Activity

  1. stefanv commented on Jun 12, 2026

    @stefanv
    Member

    Looks like SciPy's pre-filtering is not thread-safe. For now, I disabled in the test suite to run in parallel.

  2. stefanv commented on Jun 12, 2026

    @stefanv
    Member

    We should double check which code path is followed: if this uses our internal warping code, the fault is in skimage, otherwise in scipy.ndimage's map_coordinates. It would make slightly more sense for the error to be in the latter, but I'd have to check.

  3. stefanv commented on Jun 12, 2026

    @stefanv
    Member

    Looks like we do go via the ndimage path.

    Asked Claude to investigate, and it seems to say that even np.dot is not thread-safe. Is that possible?!

    So the actual root cause is OpenBLAS's internal thread pool not being safe when the same shared
    ThinPlateSplineTransform instance's np.dot(coords, a[1:]) / np.dot(radial_dist, w) are issued
    concurrently from multiple application threads (this numpy build uses scipy-openblas64 0.3.31 with
    pthreads threading, DYNAMIC_ARCH). This reproduces even on a normal GIL-enabled CPython — it's not
    specific to free-threaded 3.14, it's a long-standing OpenBLAS multi-threading hazard that
    pytest-run-parallel's concurrent test execution happens to trigger.

    @ngoldbaum would probably know this off-hand.

  4. ngoldbaum commented on Jun 13, 2026

    @ngoldbaum
    Contributor

    This is an OpenBLAS bug I think, see numpy/numpy#31618 and OpenMathLib/OpenBLAS#5836

  5. kumaraditya303 commented on Jul 24, 2026

    @kumaraditya303

    I think this is fixed now with OpenMathLib/OpenBLAS#5876

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions