Expand description
The pure state machine behind network record and replay.
The engine models the guest-visible state of each outbound TCP channel:
which inbound bytes have been released to the guest, whether the peer
closed or reset the connection, how many bytes the guest transmitted, and
the receive low-water mark. It performs no I/O. The runtime asks it what a
guest recv, poll or send observes at a given global time, and in
record mode feeds it the bytes it pulled from the host.
Determinism rests on the release rule of NetworkReleaseV1: an input
becomes visible once global time has reached the time at which the
recording first observed it and the guest has transmitted at least as
many bytes on that channel as it had by then. Both quantities are
functions of the guest’s own deterministic execution, so a replay never
depends on host timing, and a replay that follows the recorded schedule
observes every input at the same check that the recording did.
A blocking receive completes once enough bytes are available to satisfy its target, all at once. Linux may copy a partial segment into the buffer of a waiting reader before the rest arrives; the engine instead hands out the bytes as if they had arrived together, which is one of the outcomes Linux permits.
Structs§
- Network
Engine - The guest-visible network state of one record or replay run.
- Send
Mark - Where a recorded send left a channel’s outbound stream: its offset, and
how many output events (accepted chunks and refused sends) the channel
has recorded. A blocking send that waits for buffer space passes its mark
back with its next chunk; any output event in between changes
events, even a refusal, which does not moveoffset.
Enums§
- Network
Arrival - Something the recorder pulled from a host socket.
- Network
Engine Error - A failure that ends the run: the guest asked for something the recording cannot answer, or that this version does not model.
- Network
Recv Outcome - What a guest receive observes.
- Network
Reply - The answer to a
NetworkRequest. - Network
Request - One engine operation, carried from a guest thread to the global state.
- Replay
Send Outcome - What
NetworkEngine::replay_senddid with a guest send.
Constants§
- REPLAY_
STALL_ LIMIT - How long past an input’s recorded arrival, in global (virtual) time, replay waits for the guest to send the bytes that gate it before declaring that the guest diverged. It has the same length as the host waits of record mode, but those are wall-clock waits.