Fix byte-based JSON-RPC framing and request-id race (Python client) - #5
Merged
Conversation
unp1
force-pushed
the
fix/python-rpc-correctness
branch
from
June 22, 2026 16:52
79712b2 to
35e5cbf
Compare
This was referenced Jun 22, 2026
unp1
force-pushed
the
fix/python-rpc-correctness
branch
from
June 22, 2026 19:41
35e5cbf to
eee3187
Compare
wadoon
approved these changes
Jun 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The fix for that one is on #7, which need to be applied first
Fixes two correctness bugs in the Python client transport (
keyext.client.python):recv_responseread N characters from a text stream, truncating any message past the first non-ASCII glyph (common in KeY terms) and desyncing the stream. The transport now uses binary streams, frames on the UTF-8 byte length, and reads exactlyContent-Lengthbytes (looping over short reads).NetKeYopens binary socket makefiles to match.next_idwas incremented without a lock, so concurrentcall_methodcalls could share an id and have responses delivered to the wrong caller. Id allocation is now lock-guarded.Adds
tests/test_rpc.py(stdlibunittest): byte-counted framing, raw-UTF-8 reads (incl. back-to-back and partial reads), and concurrent id allocation. All green.PR has been created with AI tooling