Skip to content

QueryNodesSimple exceeds gRPC's 4MB message-size limit on large databases, and the failure is silently misreported (diagnostics shows 'Total nodes: 0') #2286

Closed

Description

@mstomar125

Problem

A large local database can hit gRPC's default 4MB message-size limit on list/query operations, causing them to fail — and the failure is silent/misleading rather than surfaced clearly: nodespace diagnostics reported "Total nodes: 0" (wrong — the database genuinely has 388 root nodes) alongside an error that's easy to miss in the output:

Errors:
  - QueryNodesSimple failed: status: OutOfRange, message: "Error, decoded message length too large: found 8933414 bytes, the limit is: 4194304 bytes"

Reproduction

Pointed a daemon at a real, large historical database (63.5MB, 388 root nodes) and ran nodespace diagnostics. The node-count query response (8.9MB) exceeded the client's default 4MB gRPC receive limit.

Impact

  • diagnostics's node-count display is wrong (shows 0) instead of failing loudly, which could mislead someone debugging a different problem.
  • Any other list/query RPC that returns this many nodes in one response would presumably hit the same wall — worth checking whether this affects the desktop app's own bulk-fetch paths (e.g. initial sidebar population, full-database export) for users with large real databases, not just the CLI's diagnostics command.

Fix direction

Either: (a) raise the client's/server's gRPC max message size for this RPC (Tonic exposes this via channel/service builder config), or (b) paginate QueryNodesSimple's response so it never needs to return an unbounded node count in one message, or (c) at minimum, surface the query failure as a visible error in diagnostics's own output instead of silently showing "0".

Severity

minor-to-important depending on scope — didn't observe it affecting writes (create/update both succeeded cleanly against this same database), only a read/list path. Worth checking whether the desktop app UI has an equivalent large-response code path that could silently show empty state the same way.


Found incidentally while validating core#2269 against a real, large historical database (2026-08-25).

Activity

  1. added
    bug
    on Aug 25, 2026
  2. self-assigned this
    on Aug 25, 2026
  3. mstomar125 commented on Aug 25, 2026

    @mstomar125
    ContributorAuthor

    Resolved in #2294.

    Root cause: client-side receive limit. tonic 0.12 defaults max_decoding_message_size to 4 MiB and max_encoding_message_size to usize::MAX, and nothing in this repo configured either — so the daemon sent the 8.9 MB response fine and the CLI refused to decode it. Every list-shaped RPC in node_service.proto returns full node records in one unary message and had the same wall (GetRoots, GetChildren, GetChildrenTree, GetCollectionMembers*, SearchNodes, ExportMarkdown, …), including the desktop app's own page-load path (get_children_tree).

    Fix: one MAX_MESSAGE_SIZE_BYTES (64 MiB) constant plus a with_message_limits! macro in nodespace-proto, applied to every daemon service stub, every CLI client, every desktop-app client, and the dev-proxy's grpc-js channel (grpc-js has the same 4 MiB default). Separately, diagnostics no longer substitutes zero for a failed query: the count/recency fields are Option, the output prints unknown / null, truncation moved to a new warnings list, and the command now exits non-zero when anything failed.

    Follow-up: #2289 — the ceiling is not a bound. The list RPCs need a count-only path and a cursor contract, which first requires SqliteStore::query_nodes to gain a deterministic ORDER BY (it currently pages with LIMIT/OFFSET and no ordering, so offset-paging can skip or duplicate rows).

    Left open for review — not self-merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions