8000 bindings: constructing an EvalState in a forked child aborts, which blocks the fork route for a no-collector build · Issue #83 · nixidae/nixidae · GitHub
[go: up one dir, main page]

Skip to content

bindings: constructing an EvalState in a forked child aborts, which blocks the fork route for a no-collector build #83

Closed

Description

@Lillecarl

What

nanopynix.EvalState(store, [], fetch_settings=...) aborts when it runs in a
child that pytest-forked created. The abort is an uncaught C++ exception:
the C stack ends in libstdc++ and then abort.

tests/nanopynix/bindings/test_flake.py .Fatal Python error: Aborted

Current thread ... (most recent call first):
  File "tests/nanopynix/bindings/test_flake.py", line 128 in test_the_evaluator_refuses_a_dirty_tree_when_allow_dirty_is_off
  ...
  File ".../pytest_forked/__init__.py", line 68 in runforked
  File ".../py/_process/forkedfunc.py", line 65 in _child

Line 128 is the EvalState construction itself, and not the lock_flake
call after it.

Evidence that the fork is the cause

Both runs use the same runner,
nanopynix-tests-nix_2_34-nogc, and the same store backend:

run selection result
forked TestGitFetcherSettings 1 passed, 2 aborted
--in-process-evaluator=run TestGitFetcherSettings 3 passed

73 of 75 tests of the wider subset (tests/nanopynix/core and
tests/nanopynix/bindings/test_flake.py) pass under the fork. The two that
abort are the two that build an EvalState with their own fetch_settings,
rather than taking the session-scoped eval_state fixture.

Why this matters

These two tests are the acceptance test of #64. TestGitFetcherSettings
holds the stack-use-after-return of #63, which is the defect the ASAN job
exists to catch.

It also blocks a route that would otherwise close a gap in #76. A build with
no collector leaks by design, so tests/support/nix_runtime.py skips every
test that builds an evaluator in the pytest process. A fork per test would
give the memory back and let the whole in-process subset run under ASAN. That
route is closed while this abort stands, and --in-process-evaluator=fork
carries the mode with the failure documented.

What is not yet known

  • The exception is not named. terminate called after throwing does not
    reach the log, so the next step is to catch std::terminate or to run the
    child under a debugger.
  • Whether the fork is unsafe in general, or only after the parent process has
    reached a particular state. The parent runs collection only, and collection
    calls nanopynix.build_info().
  • Whether fetch_settings is the discriminator, or whether a second
    EvalState in one process is.

Whether this reaches a consumer is the first question to answer. A library
that aborts in a forked child is a defect of the library and not of the test
harness, and a consumer that forks would meet the same abort.

Acceptance criteria

  • The exception is named, and the cause is stated.
  • Either an EvalState constructs in a forked child, or the reason it cannot
    is recorded where a consumer will read it.

Tests

  • TestGitFetcherSettings under --in-process-evaluator=fork, against a
    no-collector build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    source: nanopynix

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0