Skip to content

Windows abrupt shutdown & Coverage - #335

Merged
sgerbino merged 10 commits into
cppalliance:developfrom
sgerbino:pr/windows-coverage
Aug 11, 2026
Merged

Windows abrupt shutdown & Coverage#335
sgerbino merged 10 commits into
cppalliance:developfrom
sgerbino:pr/windows-coverage

Conversation

@sgerbino

Copy link
Copy Markdown
Collaborator

No description provided.

detail::timer's consumers construct it only from an execution
context and set expiry separately, so the time-point, duration, and
executor convenience constructors had no callers. The move
operations only exist so a disengaged std::optional<timer> can be
moved; io_object already implements the transfer, so defaulting
them replaces the out-of-line definitions.
make_win_timers has always returned the thread-based timers; the
NtAssociateWaitCompletionPacket path was compiled but unreachable
behind #if 0. The reason it lost — one-shot packets force a full
re-association on every scheduler wakeup — now lives at the
selection site.
Both engines latched a setup error for a bad trust anchor but
silently dropped an entity certificate or private key that failed
to parse or decrypt, deferring the misconfiguration to an opaque
handshake failure on the peer. Latch the same flag on those paths:
the OpenSSL engine refuses the handshake through check_context(),
wolfSSL refuses directly from init.

Cover the credential-parsing paths from both sides: a full engine
handshake from DER-converted fixtures, plus setup refusal for a
garbage DER certificate and for a key whose oversize callback
password is truncated to OpenSSL's buffer.
…tdown

The shutdown drain waited for the run-loop work counter to reach
zero, but that counter includes work-guard credits — and a coroutine
frame abandoned with a parked operation at teardown (the documented
shutdown contract) holds its run_async guard forever, so the
destructor spun on a credit that could never be returned.

The drain's actual precondition is narrower: no packet referencing
overlapped-op memory may remain in flight to the completion port
when the services free that memory. Count exactly that — a packet is
owed after on_pending's publish (the kernel's completion will
dispatch) or a successful stored-result post, and consumed at the
single dispatch point per operation — and let shutdown reap until
this count is zero. The run-loop counter keeps its original meaning
untouched, and guards, posted handlers, and queued continuations
are simply outside the drain's concern.
Completions can reach the port or the deferred queue without a
matching work credit — posted directly against the handle, or left
behind once their credit was consumed. Destroy them after the
counted drain so service teardown does not free state they still
reference.
Most local-stream socket and acceptor tests were gated behind
BOOST_COROSIO_POSIX from before connect_pair and AF_UNIX support
existed on Windows. Ungate everything that needs only the public
API, keeping the raw-fd backlog test POSIX-only, and add tests for
wait(error) cancellation, in-flight read cancellation through
cancel() and stop tokens, zero-length transfers, socket options,
and acceptor waits. The acceptor wait(write) test skips io_uring,
whose poll never reports a listener writable.

Also add direct unit tests for intrusive_list and intrusive_queue,
option get/set round-trips with closed-object throws for the TCP
and local acceptors, a delay test that re-issues waits so timer
impls are drawn back out of the thread-local cache slot and the
service free list, and coverage for both the WSA and Win32 forms
of the IOCP error-code mapping.
Run the parked-accept and parked-read teardown tests for both local
stream and TCP sockets on Windows, where they previously never ran.
Destroying the context with operations still parked abandons their
coroutine frames by design; these pin the IOCP shutdown drain to
that contract.
Both were gated with the raw-socket includes even though only the
backlog test touches raw sockets — and its calls are identical in
Winsock apart from the handle type and closesocket. The no-listen
accept gains the watchdog canceller used by its local-stream
sibling, since a platform may park the accept instead of failing
it.
local_endpoint is a value type, so constructing, classifying, and
formatting an abstract address needs no kernel support; only binding
one is Linux-specific. Ungate those checks, and verify on Windows
that binding an abstract endpoint is refused with
operation_not_supported rather than binding something else.
@cppalliance-bot

cppalliance-bot commented Aug 11, 2026

Copy link
Copy Markdown

An automated preview of the documentation is available at https://335.corosio.prtest3.cppalliance.org/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-08-11 19:03:24 UTC

@cppalliance-bot

cppalliance-bot commented Aug 11, 2026

Copy link
Copy Markdown

GCOVR code coverage report https://335.corosio.prtest3.cppalliance.org/gcovr/index.html
LCOV code coverage report https://335.corosio.prtest3.cppalliance.org/genhtml/index.html
Coverage Diff Report https://335.corosio.prtest3.cppalliance.org/diff-report/index.html

Build time: 2026-08-11 19:18:16 UTC

The interleaved deadlines were all a few milliseconds out and the
test asserted the middle three were canceled before any fired — a
wall-clock race that fails under heavy slowdown (observed under
valgrind, where all five expired first). Park the cancel targets
hours out so no slowdown can expire them; only the two short delays
ever fire, and removing the middle hour entry still exercises heap
interior removal.
@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.82%. Comparing base (82e8c00) to head (2b22c8d).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #335   +/-   ##
========================================
  Coverage    79.81%   79.82%           
========================================
  Files           96       96           
  Lines         5946     5937    -9     
  Branches      1213     1209    -4     
========================================
- Hits          4746     4739    -7     
+ Misses         852      851    -1     
+ Partials       348      347    -1     
Files with missing lines Coverage Δ
...boost/corosio/native/detail/iocp/win_scheduler.hpp 63.94% <ø> (+0.60%) ⬆️
...de/boost/corosio/native/detail/iocp/win_timers.hpp 100.00% <ø> (ø)
src/corosio/src/timer.cpp 100.00% <ø> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 82e8c00...2b22c8d. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sgerbino
sgerbino merged commit 1f3d91d into cppalliance:develop Aug 11, 2026
44 checks passed
@sgerbino
sgerbino deleted the pr/windows-coverage branch August 11, 2026 19:42
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Beast2 Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants