Skip to content

Three point-locator tests fail when xdist worker count changes the file grouping #567

Description

@lmoresi

Found while measuring parallel test runs (#566).

What happens

Running level 1 under pytest-xdist --dist loadfile at 16 workers on a 16-core box:

FAILED tests/test_0761_point_locator.py::test_p1_field_on_a_shared_edge_matches_the_closed_form[2d-0.0]
FAILED tests/test_0761_point_locator.py::test_p1_field_on_a_shared_edge_matches_the_closed_form[2d-0.5]
FAILED tests/test_0761_point_locator.py::test_p1_field_on_a_shared_edge_matches_the_closed_form[2d-0.25]

The same selection is green at 4 and at 8 workers, and green serially.

It is not load, and not telemetry

  • Deterministic: identical three failures across two runs.
  • Not telemetry: UW_ENABLE_TELEMETRY=0 (which test_levels.sh sets specifically to avoid a kdtree race) makes no difference — same three failures.
  • The failure is an accuracy assertion in uw.function.evaluate at points on cell edges, not a crash or a resource error.

With --dist loadfile, the worker count determines which files share a process. So the most likely reading is test pollution: some other file landing in the same worker leaves state that changes what the locator returns. The test itself is explicit about what it is discriminating — "a locator that returns any cell CONTAINING the point gives the exact answer, and a locator that returns a cell merely NEAR it does not" — so whatever the leaked state is, it is plausibly steering cell selection.

Why it matters beyond the test

If global state can change which cell a point-location query resolves to, that is worth understanding even for serial users: it means an evaluation's accuracy depends on what the process did earlier. It may equally turn out to be a fixture or a cached mesh in the test file. Either answer is worth having.

Reproducing

OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=1 \
  pytest --config-file=tests/pytest.ini tests/ \
  -m "level_1 and not level_2 and not level_3" -q -n 16 --dist loadfile

--isolation (one worker, still per-file) is the tool for bisecting which preceding file is responsible.

Related: the locator suite is recent (#556, part of the #551 umbrella), and these tests had no prior parallel exposure.

Underworld development team with AI support from Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions