Skip to content

Windows: verify a blocked fwrite() detects a peer connection reset #134

Closed

Description

@EdmondDantes

Split off from the #129 I/O chaos work. Not a regression — pre-existing.

Context

tests/stream/046-write_wakes_on_peer_reset.phpt is the regression test
for the #129 item 1 fix: a coroutine suspended in fwrite() on a full
send buffer must be released when the peer abruptly resets the
connection, instead of hanging forever. That fix lives in the POSIX
poll/POLLERR path (async_poll_notify_proxies — a disconnect/error
is treated as terminal for every proxy on the descriptor).

Observation on Windows

The test fails on Windows (it has since it was added; it was masked by
the tests/io/083 failure until #133 fixed that). The CI diff:

- second fwrite failed: yes
+ second fwrite failed: no

Two things are clear from the run:

  • The test does not hang on Windows — it runs to completion and
    prints its output. So the catastrophic symptom I/O chaos follow-up: write-path toxics, real RST, forked peer, failure-freeze #129 item 1 fixed
    (an infinitely parked writer) does not reproduce on Windows.
  • The narrow discrepancy: after the peer RST, the second fwrite()
    reports success on Windows where POSIX reports failure. Winsock/IOCP
    surfaces WSAECONNRESET to a write on a different schedule.

What needs verifying

It is not yet determined whether this is:

  1. Test over-specification — "the error lands on exactly the 2nd
    write" is a POSIX-specific timing. Windows may surface the reset on
    a later write / via feof() / via a stream error, and the runtime
    is fine. → adjust the test for Windows.
  2. A real Windows gap — the IOCP reactor does not propagate the
    peer reset to a blocked/again-writing coroutine, so writes to a dead
    socket keep silently succeeding. → real bug to fix in the reactor.

A diagnostic test (issue more writes after the reset, check feof()
and the stream error state, observe whether the reset is ever
detected) run on the Windows CI runner would settle which it is.

Current state

046-write_wakes_on_peer_reset.phpt is --SKIPIF--'d on Windows so CI
is green; the POSIX path stays covered. This issue tracks the Windows
verification.

Activity

  1. added 2 commits that reference this issue on May 22, 2026
  2. self-assigned this
    on May 27, 2026
  3. added this to the TrueAsync 0.7.0 milestone on May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions