Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Fault Reference

Consolidated quick-reference of every fault moonpool-sim can inject, organized by category. For detailed explanations and examples, see Network Faults, Storage Faults, and Attrition: Process Reboots.

Every fault listed below is automatically emitted to the "sim_fault" event timeline as a SimFaultEvent. Invariants can read these to correlate application behavior with infrastructure faults.

All defaults below refer to the values in ChaosConfiguration::default() and StorageConfiguration::default(). When using random_for_seed(), these values are randomized per seed within documented ranges.

Network Faults

Configured via ChaosConfiguration (nested under NetworkConfiguration::chaos).

Connection Failures

FaultConfig FieldDefaultReal-World Scenario
Random connection closerandom_close_probability0.001%Reconnection logic, message redelivery, connection pooling
Close error surfacingrandom_close_explicit_ratio30% immediate error, 70% silent closeExplicit-error and timeout-based detection
Close cooldownrandom_close_cooldown5sPrevents cascading failures after a close event
Black holeblack_hole_probability0% (off)A direction that delivers nothing, forever: writes are accepted until the send window fills, then block. Missing request timeouts, keep-alive and heartbeat detection, half-open connections, writers without a deadline
Black hole cooldownblack_hole_cooldown5sSpaces out black holes across connections
Connect failureconnect_failure_modeProbabilistic (50% refused, 50% hang)Connection establishment retries, timeout handling
Connect failure probabilityconnect_failure_probability50%Ratio of failed vs hanging connections

Latency and Congestion

FaultConfig FieldDefaultReal-World Scenario
Operation latency shapebind/accept/connect/write_latencyUniformP99/P99.9 tail latency testing
Exponential tailLatencyDistribution::Exponential { min, mean }opt-inSlow disks, GC pauses (TigerBeetle model)
Bimodal tailLatencyDistribution::Bimodal { fast_range, slow_range, slow_probability }opt-inRare cross-datacenter hops, GC spikes (FoundationDB model)
Write cloggingclog_probability / clog_duration0%, 100-300msBackpressure handling, flow control
Per-pair permanent latencymax_pair_latencyZERO..ZERO (off)One stably-slow peer blocking quorum, asymmetric link delay
Distance-based link latencylink_latency (LinkLatencyConfig)None (off)Loopback vs rack vs region hops, cross-datacenter replication cost
Clock driftclock_drift_enabled / clock_drift_maxenabled, 100msLease expiration, distributed consensus, TTL handling
Buggified delaybuggified_delay_probability / buggified_delay_max25%, 100msRace conditions, timing-dependent bugs
Handshake delayhandshake_delay_enabled / handshake_delay_maxenabled, 10msTLS negotiation, connection startup overhead

Network Partitions

FaultConfig FieldDefaultReal-World Scenario
Random partitionpartition_probability0%Split-brain, quorum loss, leader election
Partition durationpartition_duration200ms-2sRecovery time after network heal
Partition strategypartition_strategyRandomRandom / UniformSize / IsolateSingle patterns
Failure-domain partitionpartition_strategy = IsolateZone / IsolateDatacenterRandomRack or region cut (needs a cluster topology, else falls back to Random)
One-way partitionpartition_strategy = AsymmetricSend / AsymmetricRecvRandomHalf-reachable node, failure detectors that infer liveness from the wrong direction

Manual partition methods are also available on SimWorld: partition_pair(), partition_send_from(), and partition_recv_to(). partition_pair(from, to, ...) creates one directed pair entry; restore_partition(from, to) removes pair entries in both directions so a bidirectional cut can be healed with one call. Send-wide and receive-wide partitions are restored by their own expiry events.

Data Integrity

FaultConfig FieldDefaultReal-World Scenario
Bit flipsbit_flip_probability0.01%CRC/checksum validation, data corruption detection
Flip rangebit_flip_min_bits / bit_flip_max_bits1-32 bitsPower-law distribution of corruption severity
Flip cooldownbit_flip_cooldown0 (no cooldown)Rate-limiting corruption events
Partial writespartial_write_max_bytes1000 bytesTCP fragmentation, message framing
Partial readspartial_read_max_bytes1000 bytesTCP short reads, message reassembly / framing

Storage Faults

Configured via StorageConfiguration. All fault probabilities default to 0% and must be enabled explicitly or via random_for_seed(). Storage faults are scoped per process. StorageEngine owns the default profile, per-process overrides, and degradation episodes, then resolves the profile from each persistent file’s owner. Use SimWorld::set_process_storage_config(ip, config) to assign different fault profiles to individual processes.

Each delayed storage completion targets one exact OperationId. Crash, wipe, and shutdown cancel live schedules, store explicit errors for interrupted operations, and wake their registered callers. Missing completion state is never interpreted as success.

FaultConfig FieldDefaultReal-World Scenario
Read corruptionread_corruption_probability0%ECC failures, DRAM bit flips, media degradation
Write corruptionwrite_corruption_probability0%Bad sectors, controller bugs, disk full
Read EIOread_eio_probability0%The device refusing a read — an error, not corrupt bytes
Write EIOwrite_eio_probability0%The device refusing a write
Misdirected writemisdirect_write_probability0%Firmware bugs, wrong location written
Misdirected readmisdirect_read_probability0%Controller errors, wrong location read
Phantom writephantom_write_probability0%Drive lies about durability
Sync failuresync_failure_probability0%fsync fails, disk full
Short transfershort_transfer_probability0%read/write moving a prefix and returning the count
Lost directory entryunsynced_dir_entry_loss_probability0%A create, delete, or rename that no sync_dir made durable

The Crash Model

What a crash does to writes a sync had not yet made durable. Not “should a crash happen” — the harness decides that — but the physics one resolves with. Every sector written since the last sync resolves independently.

ParameterConfig FieldDefaultEffect
Clean crashclean_crash_probability10%Every unsynced write survives intact (FDB’s number)
Correlated rollbackcorrelated_rollback_probability / correlated_rollback_max_run25%, 8A contiguous sector run rolls back together (erase-block damage)
Lost sectorcrash_lost_probability0%The sector reverts to never-written and reads the fill pattern
Latent faultcrash_latent_fault_probability0%The new bytes land, but reads return deterministic damage
Shorn writeshorn_write_probability0%A sub-sector mix of old and new bytes (weakens sector atomicity)
Length changelength_survives_crash_probability50%Whether an unsynced set_len or extension survives
Fill patterngarbage_fill_probability100% (50% under random_for_seed)Whether never-written and lost sectors read garbage rather than zeros
Barrier violationbarrier_violation_probability0%A sync lies: it reports a sector durable and leaves it volatile

A sector with no other outcome lands old or new with equal probability. Every synced sector is stamped with a CRC of what the caller was told is durable; a stamp that no longer matches after a crash fails the run as a simulator bug, unless the barrier-violation family is armed, in which case it is reported as a LostSyncedWrite.

Targeted Storage Faults

Directed injections, for red tests that need a specific fault rather than a sampled one. Coordinates are a file path and a flat sector range.

MethodDescription
SimWorld::corrupt_file(path, sectors)Plant a latent read fault: deterministic damage until the sectors are rewritten
SimWorld::fail_file_with_eio(path, sectors, target)Fail reads and/or writes touching the sectors
SimWorld::clear_file_eio(path, target)Clear the above
SimWorld::corrupt_durable_out_of_band(path, sector)Mutate a durable sector behind the crash model — a deliberate simulator bug, for testing the oracle
SimWorld::set_storage_eligibility_mask(mask)(path, sector) -> bool, consulted before any random fault damages a sector
SimWorld::take_storage_fault_records()Drain the faults injected so far
SimWorld::take_storage_crash_reports()Drain what each crash did, per file and per sector

Per-Process Storage Operations

MethodParametersDescription
SimWorld::set_process_storage_config(ip, config)IpAddr, StorageConfigurationSet per-process fault config (overrides global)
SimWorld::simulate_crash_for_process(ip, close_files)IpAddr, boolSimulate power loss: resolve every unsynced sector and directory entry, optional file close
SimWorld::wipe_storage_for_process(ip)IpAddrDelete all storage owned by the process
SimWorld::storage_provider(ip)IpAddrCreate a SimStorageProvider scoped to this process

Storage Performance Simulation

Storage also simulates realistic performance characteristics independent of fault injection.

ParameterConfig FieldDefaultDescription
IOPSiops25,000I/O operations per second limit
Bandwidthbandwidth150 MB/sMaximum throughput
Read latencyread_latencyUniform 50-200usPer-read operation delay (a LatencyDistribution)
Write latencywrite_latencyUniform 100-500usPer-write operation delay (a LatencyDistribution)
Sync latencysync_latencyUniform 1-5msPer-sync/flush delay (a LatencyDistribution)

Dynamic Disk Degradation Episodes

Episodic degradation layered on top of steady-state timing (FoundationDB’s DiskFailureInjector). Off by default and scoped per process (per owning IP): one episode freezes or throttles every file that process owns together, modelling device-level degradation, while other machines stay unaffected. While disabled, the episode state machine never draws from the RNG stream, so steady-state runs stay deterministic.

EpisodeConfig FieldDefaultWhile active
Stalldisk_stall_probability / disk_stall_duration0%, 0msDisk frozen until expiry; I/O waits out the window
Throttledisk_throttle_probability / disk_throttle_duration0%, 0msEffective IOPS/bandwidth divided by the multipliers
Throttle factordisk_throttle_iops_multiplier / disk_throttle_bandwidth_multiplier1.0Divisor applied to IOPS / bandwidth during a throttle

Disk Failure

A disk that never answers (FoundationDB’s failedDisk, where waitUntilDiskReady() returns Never()). Off by default and scoped per process: every read, write, sync, or set_len issued to a failed disk is accepted and stays Pending for the rest of the run, with no error and no scheduled completion. At most one disk is failed at a time; a crash or wipe of the owning process replaces it and fails the parked operations with OperationInterrupted. Recovery mode stops new failures but keeps one already in force. SimWorld::fail_disk_for_process(ip) is the scripted form.

FaultConfig FieldDefaultEffect
Disk failuredisk_failure_probability0%Every later I/O on that process’s disk parks forever; only the caller’s timeout or a process kill unblocks it

Process Lifecycle Faults

Configured via Attrition (built-in) or custom FaultInjector implementations.

FaultMechanismBehavior
Graceful rebootRebootKind::GracefulSignal shutdown token, wait grace period (default 2-5s), force kill, restart after recovery delay (default 1-10s)
Crash rebootRebootKind::CrashImmediate task abort at the crash instant, all connections reset, restart after recovery delay
Crash + wipeRebootKind::CrashAndWipeCrash behavior + immediate wipe of all persistent storage owned by the process (scoped by IP)
Continuous attritionAttrition configRandom reboots during chaos phase with weighted prob_graceful/prob_crash/prob_wipe and max_dead limit
Correlated rebootAttritionScope::PerMachine / PerZone / PerDatacenterReboot every process of one failure domain together; only fires when the whole group fits in max_dead

Configuration Presets

PresetDescription
NetworkConfiguration::random_for_seed()All chaos parameters randomized per seed for comprehensive testing
NetworkConfiguration::fast_local()1-10us latencies, all chaos disabled
ChaosConfiguration::disabled()Zero probability for every fault category
StorageConfiguration::random_for_seed()Randomized faults (0.001%-0.1%), varied IOPS (10K-100K), varied bandwidth (50-500 MB/s)
StorageConfiguration::fast_local()1M IOPS, 1 GB/s bandwidth, 1us latencies, all faults disabled

See Configuration Reference for the complete builder API and all configuration types.