Skip to content

Fix #55 frame drain; log dropped sidecar notifications; support languageclient 11 - #62

Merged
MelbourneDeveloper merged 2 commits into
mainfrom
fix/frame-too-large-drain
Nov 18, 2026
Merged

MelbourneDeveloper merged 2 commits into
mainfrom
fix/frame-too-large-drain

Conversation

@MelbourneDeveloper

@MelbourneDeveloper MelbourneDeveloper commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

TLDR

FrameTooLarge now discards the refused body, so a server can refuse one oversized message and keep reading the connection. Fixes #55. Also: dropped sidecar notifications are now logged, and @nimblesite/lsp-profiler-ui accepts vscode-languageclient 11 (both asked for by SharpLsp).

Added

  • refuse in crates/lspkit-server/src/jsonrpc.rs: drains the claimed body bytes through tokio::io::copy into tokio::io::sink() (fixed-size buffer, never allocated to the claim), then returns FrameTooLarge; an I/O error while draining is FramingError::Io.

  • lspkit::sidecar::inbound: when the notification buffer is full, a tracing::warn! with dropped (running total) and capacity fires each time the total reaches a power of two, so a flood logs O(log n) lines. tracing becomes a normal dependency of lspkit; tracing-subscriber is a dev-dependency for the capture.

Changed/Deleted

  • lsp-profiler-ui peer range ^9.0.1 || ^10.1.0 || ^11.0.0; dev deps vscode-languageclient/vscode-languageserver ^11.0.0, vscode-languageserver-textdocument ^1.0.16.
  • Deleted a stray tracked __pycache__/*.pyc under crates/lsp-profiler-python/tests/python/.
  • read_message_within calls refuse instead of returning before the body.
  • FrameTooLarge docs: the connection stays usable. HeaderTooLarge docs: no frame boundary is known, so the connection cannot continue.
  • Test renamed oversized_content_length_is_rejected_without_allocating_the_claim (the body is now read, so "before any body is read" was false).

How tests prove it

  • tests/jsonrpc.rs::a_refused_frame_leaves_the_stream_at_the_next_frame (red before the fix: BadHeader("missing")): with cap 4, frames of 8, 2, 5 and 44 bytes give FrameTooLarge{8}, BadJson (2-byte frame read whole), FrameTooLarge{5}, the decoded notification, then Closed.
  • tests/jsonrpc_frame_heap.rs (red before the fix: HeaderTooLarge): a 64 MiB + 1 frame followed by a valid one allocates < 64 KiB under the instrumented allocator, returns FrameTooLarge, then decodes the next message.
  • lspkit/tests/sidecar_notification_bound.rs::unread_notifications_stay_bounded_and_every_drop_is_reported (red before the fix: no WARN events): 1024 + 64 notifications leave exactly 1024 queued, dropped_notifications == 64, and the JSON log has WARN events with dropped 1, 2, 4, 8, 16, 32, 64 and capacity 1024.
  • Profiler UI on languageclient 11.0.0: lint clean, 191 + 1 + 117 tests passing.
  • make ci green locally (before the second commit; lint and the touched suites rerun after).

Spec/doc changes

  • [JSONRPC-FRAME-LIMIT] in docs/specs/lspkit-spec.md: oversized bodies are discarded, never allocated, and the connection continues; after HeaderTooLarge it cannot.

Breaking changes

None. Behaviour only: the reader advances past a refused frame.

🤖 Generated with Claude Code

Christian Findlay added 2 commits November 19, 2026 06:35
FrameTooLarge left the claimed body in the stream, so the next read parsed
inside it and every consumer had to end the session. The body is now
drained through a fixed-size buffer before the error returns. Tests: a
refused frame followed by valid ones, and a 64 MiB + 1 discard staying
under a 64 KiB allocation bound.
inbound: a full notification buffer now warns, with the drop total and
capacity, each time the total reaches a power of two. The bound test asserts
the exact drop count and the logged totals 1..64.

lsp-profiler-ui: peer range adds ^11.0.0; dev deps move to
vscode-languageclient/-languageserver 11, all UI suites green.
@MelbourneDeveloper MelbourneDeveloper changed the title Discard a refused frame's body so the connection continues (#55) Fix #55 frame drain; log dropped sidecar notifications; support languageclient 11 Nov 18, 2026
@MelbourneDeveloper
MelbourneDeveloper merged commit 361e078 into main Nov 18, 2026
10 checks passed
@MelbourneDeveloper
MelbourneDeveloper deleted the fix/frame-too-large-drain branch November 18, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FrameTooLarge leaves the oversized body in the stream: the connection cannot continue

1 participant