Unit 8 of 8 · about 3 hours · implement, measure
Deterministic network fault injection
Robustness claims are predictions until a fault schedule runs. This unit builds the harness the milestone's fault-tested service slice depends on, with the deterministic schedules of systems/concurrency-bounded-work/schedule-testing-contention.
You'll be able to
- Implement a deterministic proxy that injects delay, duplicate, drop and restart faults on a framed protocol.
- Measure timeout, duplicate and disconnect behavior and state the resulting delivery guarantee precisely.
- Write the fault matrix the section mini-project will execute.
Covers
Read
In this order, only the parts listed
0 of 3 done
- Replicated Log and Stream Processor: protocol sliceReplicated Log and Stream Processor - protocol slice
The deterministic network fault list (delay, duplicate, disconnect, restart and companions); the protocol requirements for the single-node framed service; the delivery-contract questions
Use only the fault list and the single-node protocol slice. Replication and consensus stay in the later project.
- Failure modes and unknown outcomesAlgoMaster Networks - pcap and concurrent server labs
A Network Call Has Several Failure Points; Timeouts Turn Unbounded Waiting into a Decision; Known Failure, Known Success, and Unknown Outcome
- Observable overload and failure behaviorAlgoMaster Networks - pcap and concurrent server labs
Overload Behavior Is Observable; Failure Behavior; Common Failure Patterns
Read for the failure-injection checklist; you already implemented the server contract in the sockets unit.
Focus on
- Deterministic means seeded and scripted: same fault schedule, same interleaving, same verdict. Random chaos finds bugs; only replayable schedules prove fixes.
- Inject above TCP when testing the protocol (duplicate frames, truncated writes, slow reads) and at the connection level when testing the path (delay, drop, restart).
- Each fault has an expected client observation: delay past deadline gives timeout with unknown outcome; duplicate gives one effect under keys; drop gives disconnect with unknown outcome.
- Restart is two faults at once: in-flight requests resolve as unknown, and post-restart state must reconcile pre-restart keys by policy.
Common mistakes · 3
- Counting a passed clean-path test as fault coverage. Timeouts, duplicates and restarts exercise different code than the happy path.
- Driving fault timing from wall-clock sleeps with tight deadlines. Slow machines flake; script explicit fault steps with generous margins.
- Logging faults only at the injector. Verdicts need client observation, server state and the schedule in one record, or failures cannot be replayed.
Try it yourself
Closed-book, before checking anything
Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.The delay fault fires but the client still reports success. Is the test wrong?Answer
Either the deadline exceeds the injected delay or the client has no deadline. A fault test must assert the client observation, not just run the injector.
2.Why must the duplicate test read twice?Answer
The first read succeeds in both correct and buggy servers. Only the second read shows whether a duplicate arrived, and the effect log shows whether it executed twice.
3.The server restarts between request receipt and response. What may the client conclude?Answer
Only that the outcome is unknown. The effect may or may not have committed; resolution needs a keyed status query after reconnect.
You're done when
Your proxy replays a scripted fault schedule, every row records fault parameters with client observation and server state, and you can state the exact delivery guarantee in one sentence.
Only when you can do this without notes.
Leads to
Notes
Resources · 2 for this unit, 7 more in the section
- AlgoMaster Networks - pcap and concurrent server labsAlgoMaster · required
Use Reading a Packet Capture: A Real Bug and Building a Concurrent TCP Echo Server after the Beej implementation. Reproduce one packet-level observation and one admission, deadline or shutdown behavior in your independently written service.
- Replicated Log and Stream Processor - protocol sliceRoadmap-Final · support
Use only the protocol requirements, deterministic network fault matrix and delivery-contract questions. Build the single-node framed service now; keep replication and consensus for the later project.
Also in this section
- Beej's Guide to Network Programming - sockets to multiplexingBrian Hall · primary
Read What is a socket?, IP addresses and data structures, Client-server background, System calls or bust, Client-server examples, Slightly advanced techniques and sendall. Build the simple TCP pair first, then replace delimiter assumptions with a bounded length-prefixed protocol.
- Beej's Guide to Network Concepts - TCP and UDP pathBrian Hall · required
Read the OS and sockets, protocol layering, IP, UDP and TCP chapters alongside packet captures from your own client and server. Use it to explain transport behavior rather than memorize layer names.
- MIT 6.5840 - RPC, threads and fault vocabularyMIT PDOS · support
Read the introductory RPC and threads material plus the lab guidance. Use it to enumerate timeout ambiguity and duplicate effects. Stop before Raft and the full lab sequence.
- Designing Data-Intensive Applications, 2nd edition - Chapter 5O'Reilly · required
Read Formats for Encoding Data (printed pp. 163 to 177) for schema merits and compatibility, and Dataflow Through Services: REST and RPC (printed pp. 180 to 186) for service dataflow, version coexistence and the idempotence pointer.
- gRPC Deadlines guidegRPC Authors · reference
Read Overview, Deadlines on the Client and Deadline Propagation for absolute deadlines, remaining-time forwarding and clock-skew shielding.
- gRPC Status CodesgRPC Authors · reference
Read the full status list, including
DEADLINE_EXCEEDED,UNAVAILABLEand the codes never generated by the library, for the error taxonomy. - W3C Trace ContextW3C · reference
Read Section 3.2 for the
traceparentformat and Sections 3.4 to 3.5 for the legaltraceparentandtracestatemutations when forwarding.