Repository navigation
Description
Follow-up to the #127 / #128 / #129 I/O chaos line of work. Tracks the
largest remaining gap in the chaos suite.
The gap
The fuzzy-tests/io/ chaos suite exercises one shape only: a raw TCP
client (a coroutine) against a misbehaving TCP peer (EvilPeer) —
sliced/dripped delivery, abrupt FIN, hard RST, back-pressure, cancel
mid-transfer, forked peer, Toxiproxy transport toxics.
Two whole subsystems that do reactor I/O have rich hand-written phpt
coverage but zero chaos coverage — nothing exercises them under the
random scheduler, cancellation, or a mid-request connection failure:
| Subsystem | Hand-written tests/ |
Chaos |
|---|---|---|
| CURL (async) | ~68 phpt | none |
| PDO MySQL | ~28 phpt | none |
| PDO PgSQL | ~38 phpt | none |
| PDO SQLite | ~20 phpt | none |
| mysqli | ~10 phpt | none |
COVERAGE.md's "167/167 (100%)" is async-API-method coverage; CURL
and the DB drivers go through the reactor and are not in that count.
Why it matters
These are exactly the paths where reactor cancellation / use-after-free /
pool-state bugs hide — and the #129 work already proved the chaos suite
finds real bugs (concurrent-write data loss, writer hang on RST, the
Channel(0) split-brain). Untested today:
- a coroutine cancelled mid-HTTP-transfer / mid-SQL-query;
- the peer dropping the connection mid-response / mid-transaction;
- the PDO connection pool acquiring/releasing/replacing a slot whose
underlying connection was lost or reset; - many coroutines racing one pool / many curl handles under the random
scheduler.
Proposed approach (reuse existing infrastructure)
CURL — EvilPeer already is a misbehaving network peer; extend it
to speak just enough HTTP to be an evil HTTP server (chunked/sliced
body, slow headers, RST mid-body, wrong Content-Length). curl requests
against it under the random scheduler + a killer coroutine; Toxiproxy in
front for bandwidth/latency. New topic fuzzy-tests/curl/ (or http/).
Databases — DB drivers speak binary wire protocols, so an EvilPeer
mock is heavy. Preferred route: Toxiproxy between the PDO/mysqli
client and a real DB server (the nightly job already stands Toxiproxy
up) — inject latency, bandwidth caps, and RST mid-query / mid-transaction.
This exercises the driver's async I/O, cancellation, and the PDO pool's
acquire/release/replace under connection loss. A protocol-level mock is
likely not worth it.
Invariants (decidable regardless of interleaving):
- cancellation mid-query/transfer leaves the connection (or pool slot)
in a consistent state — no UAF, no leak; - a dropped connection surfaces as a clean error, never a hang;
- the PDO pool reclaims or replaces a broken slot; counters balance.
Out of scope here (separate, smaller io/ gaps)
IO_PLAN.md still lists TODO chaos for TCP connect, stream_select,
SSL/TLS, UDP, concurrent file writes, feof semantics, DNS, fs_watcher.
Those are raw-reactor gaps; this issue is specifically the CURL + DB
protocol-level layer (FUZZ_TESTING.md Layer 2).
Reference
fuzzy-tests/IO_PLAN.md (Layer 2), FUZZ_TESTING.md, #127, #128, #129.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
php#136 ext/curl: fix async write callback dropping a chunked respons…
#136 io-chaos: protocol-level HTTP coverage for async ext/curl
#136 db-chaos: protocol-level coverage for async PDO MySQL
#136 db-chaos: async mysqli coverage
#136 db-chaos: PgSQL coverage + concurrent transactions / heterogeneo…
#136 db-chaos: SQLite pool-focused coverage
docs: move #136 fuzzy-tests entries out of main CHANGELOG.md
ci: nightly DB chaos workflow (MySQL + PostgreSQL + Toxiproxy)
Merge pull request #137 from true-async/136-io-chaos-protocol-level-c…
#143 fuzzy-tests: curl_multi chaos + finding #145 (heap corruption on…
#143 fuzzy-tests: chaos coverage gaps — proc_open, curl_multi, feof, …