You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OPEN. Undecided on purpose. #634 made a cancelled await stop
the Nix work under it: the runtime marks the request cancelled, and
Nix raises Interrupted at its next checkInterrupt.
The rpc server calls the same wrappers. So a server handler that
grpclib cancels also cancels its Nix work, and that happens when a
client drops its stream. Nobody has decided whether that is the rule.
Two questions
Should a client that goes away stop its call? For a one-shot
eval, yes: nobody reads the answer. For a service whose state
outlives its callers (CLAUDE.md), a second client may be waiting
for the same result. The eager background evals of Nothing evaluates before it is asked #623 run
in the server's own task group and not on a client stream, so they
are not affected either way.
May one client cancel another's request? No rpc exists for it.
The request id is process-wide, so one could. The precedent is unsubscribe_logs: a shared handle grants that power to everyone
who holds it.
What is measured
Nothing on the rpc side yet. tests/test_cancel.py covers the
binding and the in-process async wrapper.
Migrated from tasks/098-what-a-dropped-rpc-stream-cancels.md.
Measured 2026-10-05, at 2b31618a+, with a throwaway probe against the test server.
A client that drops its call stops the Nix work on the server. The probe cancels a remote eval_expr after 0.3 s. The work is builtins.toJSON over 6M elements, 1.00 s uncancelled. The next call on the same state answers in 0.04 s. grpclib sends RST_STREAM on the client's cancel, the server cancels the handler, and _until_done cancels the request.
Work that never calls checkInterrupt cannot be stopped anywhere. builtins.foldl' over builtins.genList of 30M elements ran its full ~3 s after a cancel, in process (the cancelled block took 3.02 s) and over RPC alike. That is Nix: toJSON checks once per element, and this loop does not check. It is not a gap in the cancel path, and test_cancel.py already uses a primop for that reason.
So question 1 is answered by the code as it stands: a dropped stream cancels its call. Question 2 (one client cancelling another's request) still has no rpc.
Activity
Lillecarl commentedon Oct 5, 2026
Measured 2026-10-05, at 2b31618a+, with a throwaway probe against the test server.
eval_exprafter 0.3 s. The work isbuiltins.toJSONover 6M elements, 1.00 s uncancelled. The next call on the same state answers in 0.04 s. grpclib sends RST_STREAM on the client's cancel, the server cancels the handler, and_until_donecancels the request.checkInterruptcannot be stopped anywhere.builtins.foldl'overbuiltins.genListof 30M elements ran its full ~3 s after a cancel, in process (the cancelled block took 3.02 s) and over RPC alike. That is Nix:toJSONchecks once per element, and this loop does not check. It is not a gap in the cancel path, andtest_cancel.pyalready uses a primop for that reason.So question 1 is answered by the code as it stands: a dropped stream cancels its call. Question 2 (one client cancelling another's request) still has no rpc.
Assisted-By: Claude Opus 5.5