Skip to content

Fix NewlineStreamIO truncating messages larger than the read() size hint - #10

Merged
m-messer merged 1 commit into
mainfrom
fix/ipc
Aug 19, 2026
Merged

Fix NewlineStreamIO truncating messages larger than the read() size hint#10
m-messer merged 1 commit into
mainfrom
fix/ipc

Conversation

@m-messer

@m-messer m-messer commented Aug 6, 2026

Copy link
Copy Markdown
Member

NewlineStreamIO.read() stopped as soon as it had accumulated size bytes (StreamServer._handle_client always calls read(4096)), even if it hadn't found the real \n delimiter yet. Any IPC-transport JSON-RPC message over ~4KB was silently truncated mid-token, producing a parse-error response with id: null that a waiting client can never match to its request -- and left the unconsumed remainder corrupting framing for subsequent messages on the same persistent connection.

Now reads until the delimiter is actually found.

NewlineStreamIO.read() stopped as soon as it had accumulated `size`
bytes (StreamServer._handle_client always calls read(4096)), even if
it hadn't found the real \n delimiter yet. Any IPC-transport JSON-RPC
message over ~4KB was silently truncated mid-token, producing a
parse-error response with id: null that a waiting client can never
match to its request -- and left the unconsumed remainder corrupting
framing for subsequent messages on the same persistent connection.

Now reads until the delimiter is actually found.
@neagualexa neagualexa assigned m-messer and unassigned neagualexa Aug 19, 2026
@m-messer
m-messer merged commit 47023b8 into main Aug 19, 2026
4 of 6 checks passed
@m-messer
m-messer deleted the fix/ipc branch August 19, 2026 16:07
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.

2 participants