Commit a770650
committed
Fix RPC write_message to use unbuffered binary I/O on Windows
The write_message function was using text mode (sys.stdout.write) which
causes Python to perform automatic line-ending translation on Windows.
This corrupts the JSON-RPC protocol headers which expect exact byte sequences
like 'Content-Length: N\r\n\r\n'.
Use unbuffered binary I/O (os.write) instead, mirroring the pattern already
used by read_message and read_message_with_timeout which use os.read().
This ensures:
- No platform-specific line-ending translation
- Symmetric read/write I/O patterns
- Atomic writes for small RPC messages (within PIPE_BUF)
- Single system call (same as before)
Fixes the 10-second timeout failures on Windows runners where the Python
RPC server couldn't send responses to Java due to protocol header corruption.1 parent e804713 commit a770650
1 file changed
Lines changed: 9 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1380 | 1380 | | |
1381 | 1381 | | |
1382 | 1382 | | |
1383 | | - | |
1384 | | - | |
1385 | | - | |
1386 | | - | |
1387 | | - | |
1388 | | - | |
1389 | | - | |
1390 | | - | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
1391 | 1392 | | |
1392 | 1393 | | |
1393 | 1394 | | |
| |||
0 commit comments