Skip to content

fix(pty): bound ConPTY writes on Windows - #296

Closed
zackees wants to merge 4 commits into
release/0.1.3from
feat/conpty-bounded-write
Closed

zackees wants to merge 4 commits into
release/0.1.3from
feat/conpty-bounded-write

Conversation

@zackees

@zackees zackees commented Sep 17, 2026

Copy link
Copy Markdown
Owner

Refs FastLED/cli#259 (phase 3).

RED commit first: a Windows test that a bounded write returns on a ConPTY whose child is not reading. The fix follows once CI records the RED result.

🤖 Generated with Claude Code

zackees and others added 3 commits September 16, 2026 19:54
RED: on Windows write_available falls back to the blocking write, so a
client of a non-reading ConPTY can still park indefinitely.

Refs FastLED/cli#259

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
write_available had no Windows backend, so PtySession fell back to a
blocking WriteFile. Once a child stopped reading its console input the
stdin pipe filled and the write parked, and nothing on the host side could
release it: the same slot leak #256 fixed on Unix, still open on Windows.

The ConPTY master now keeps a duplicate of the stdin pipe handle when the
writer is taken. A bounded write switches that pipe end to PIPE_NOWAIT, where
a byte-mode WriteFile takes only what fits, retries a full pipe every 5 ms
until the deadline, and restores PIPE_WAIT before returning.

Refs FastLED/cli#259

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Release on release/0.1.3 containing the Windows ConPTY bounded write, on top
of v0.1.11.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@zackees
zackees force-pushed the feat/conpty-bounded-write branch from c83fb1c to 91171ee Compare September 17, 2026 03:23
The first version required 64 MiB within 30 s, which cannot tell a parked
write from a pipe that conhost drains slowly. Each call now reports as it
returns; a call that does not report within 10 s has parked.

Refs FastLED/cli#259

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@zackees

zackees commented Sep 17, 2026

Copy link
Copy Markdown
Owner Author

Closing without merge. The RED this was built on did not hold up: the first test required 64 MiB in 30 s, which measures throughput, not parking. Once rewritten to bound each call, it passed identically with and without the PIPE_NOWAIT change (#297, run 35178784740; this PR, run 35178783678). The end-to-end slot-release regression in zackees/fastled-wasm also passes on Windows against v0.1.11 (FastLED/cli#260). No failing test demonstrates a Windows leak, so no fix and no v0.1.12. Findings recorded in FastLED/cli#259.

@zackees zackees closed this Sep 17, 2026
@zackees
zackees deleted the feat/conpty-bounded-write branch September 17, 2026 04:04
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.

1 participant