8000 pynixd: a client that hangs up cancels a shared build future for every other request · Issue #15 · nixidae/nixidae · GitHub
[go: up one dir, main page]

Skip to content

pynixd: a client that hangs up cancels a shared build future for every other request #15

Closed

Description

@Lillecarl

A client that hangs up fails every other request that waits for the same build. The other request gets RuntimeError: goal child did not record a result, and its client gets an error for a build that was still running.

Cause. BuildDerivationGoal._wait_within_my_limits (pynixd/goals/build_derivation.py) does return await future in its two early returns. That future is the one BuildQueue.enqueue shares between every request that dedups onto the build. When the hung-up request is torn down, GoalEngine.reap cancels its goals. asyncio then cancels the awaited future too, and so the build is cancelled for every holder. The loop further down in the same method already avoids this with asyncio.wait, and its comment states the rule.

The other request's build goal then ends in CancelledError. ExecutionGoal.run_children runs each child in an anyio task group. anyio treats a child that ends cancelled as cancelled, not failed, so the group exits clean, the slot keeps _MISSING, and goal.py:120 raises.

Seen twice on dynhetz, 2026-10-18 (UTC), pynixd /nix/store/09hbrqjapvlkzhyvdvc21pgwjzf94m4m-pynixd-0.1.0:

17:04:40.383 client_hung_up {"op":"BuildPaths","op_seconds":2.208}
17:04:40.387 handle_op_error BuildPaths -> RuntimeError: goal child did not record a result

17:30:28.098 client_hung_up {"op":"BuildPaths","op_seconds":958.762}
17:30:28.098 client_hung_up {"op":"BuildPaths","op_seconds":953.391}
17:30:28.114 build_cancelled 15934..15941 "no goal waits for it"
17:30:29.092 handle_op_error BuildPaths -> RuntimeError: goal child did not record a result

The 17:30 traceback ends in dependencies.py:30 -> goal.py:120 run_children, under ensure.py:1224 _realise_input_derivations.

Fix: await asyncio.shield(future) at both early returns, the primitive that _the_result_unless_it_stops already uses for the same reason.


Assisted-By: Claude Opus 5.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    source: pynixd

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0