Validate buffered read ownership during Windows TLS upgrades
- Dominant language
- Python
- Stars
- 62
- Forks
- 3
- Avg merge
- 7h
- Merged PRs (30d)
- 62
Description
Decision: Needs information - plausible Windows-specific native lifetime risk.
Evidence: `zig/transport.zig:338-373` can retain a `Py_buffer` while a Windows overlapped read is pending. `pauseReading()` records `READ_STATE_PENDING`, but `setProtocol()` at `zig/transport.zig:927-931` releases the view unconditionally. `start_tls()` pauses reading and immediately replaces the protocol.
Impact: If libuv retains the supplied buffer across loop iterations on Windows, a TLS upgrade under active buffered traffic could release memory while the kernel is still writing to it.
Next action: Add an AMD64 and ARM64 Windows regression using `BufferedProtocol`, continuous reads, and repeated `start_tls()` or protocol replacement under debug allocation checks. Confirm libuv's buffer lifetime for this path.
Acceptance criteria: Either the test proves the current ordering safe and documents why, or the buffer release is deferred until the matching read callback completes.
Contributor guide
No contributing guide indexed for this repository
Research direction
Read zig/transport.zig:338-373 and 927-931, then trace pauseReading(), setProtocol(), and start_tls() during a pending BufferedProtocol read. Add the AMD64 and ARM64 Windows regression with continuous reads and repeated TLS upgrades or protocol replacement, using debug allocation checks; done means the test documents safe ordering or verifies release waits for the matching read callback.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, zig
- Domain
- backend, operating-systems, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100