Skip to content

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

Open
m-messer wants to merge 1 commit into
mainfrom
fix/ipc
Open

Fix NewlineStreamIO truncating messages larger than the read() size hint#10
m-messer wants to merge 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.
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