8000 What a dropped rpc stream cancels · Issue #635 · nixidae/nixidae · GitHub
[go: up one dir, main page]

Skip to content

What a dropped rpc stream cancels #635

Closed
Closed

Description

@Lillecarl

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

  1. 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.
  2. 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.


Assisted-By: Opus 5

Activity

  1. Lillecarl commented on Oct 5, 2026

    @Lillecarl
    ContributorAuthor

    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.


    Assisted-By: Claude Opus 5.5

  2. added
    source: huggorm
    on Oct 19, 2026
  3. transferred this issue fromnixidae/huggormon Oct 19, 2026
  4. added theissue type on Oct 19, 2026
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

    source: huggorm

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0