Repository navigation
v3.5.0
forkrun v3.5.0 Release Notes: The Hardened Exascale Release
We are proud to announce the release of forkrun v3.5.0.
While v3.0 established forkrun’s signature C-ring dataflow architecture and single-node throughput records, v3.5.0 transforms the engine from an ultra-fast parallelizer into an industrial-grade, adversarial-resistant dataflow platform ready for multi-socket HPC systems like Frontier.
This release represents a comprehensive subsystem overhaul: exact-line batching (-L) and deterministic stream limits (-n) are now natively parallelized across NUMA topologies; the execution metric has been expanded to a full 64-bit coordinate plane; the native C Plugin ABI has been formally frozen into a cache-aligned 128-byte layout; the resume subsystem has been rebuilt from scratch behind a 3-layer security sandbox; and output streams are now protected by closed-loop hydraulic backpressure.
🚀 Headline Highlights
1. NUMA-Native Exact Lines (-L) and Stream Limits (-n)
In previous versions, enforcing exact record counts (-L N) or stopping after an exact record limit (-n N) forced forkrun to demote execution to single-socket UMA mode to avoid inter-socket boundary races.
In v3.5.0, -L and -n run natively across all NUMA domains via the Scanner-Handoff Chain:
-
Cumulative Line Tracking (
cum_lines): Scanning headwaters serialize across node scanners via an acquire/release cumulative count chain. Delimiter parsing remains strictly local at memory bus bandwidth—zero duplicate scanning. -
Bounded Halo Seams: When a batch of
$N$ lines straddles a physical 2 MB NUMA chunk boundary, the worker pulls its initial$1 \dots N-1$ lines across the socket seam. -
Deterministic Clamping: When
-nis reached, the crossing scanner rewinds within memory to the exact delimiter, assertslimit_cutoff_major, and propagates sentinel skips forward. - Result: Exactness is mathematically preserved, worker execution remains 100% parallelized across all cores, and cross-socket memory traffic remains under 0.1%.
2. Native C Plugin ABI v2: Frozen at 128 Bytes (-C)
For workloads bypassing the shell AST entirely via native C shared objects, v3.5.0 officially freezes the Plugin Context ABI v2:
-
128-Byte Cacheline Alignment: The
forkrun_ctxstructure has been expanded and aligned to exactly 128 bytes, eliminating false sharing across cores on high-density processors. -
Masked Dialect & Feature Negotiation:
forkrun_use_ctxnow encodes a dialect byte (masked via0xFF) alongside optional behavior flags (FORKRUN_CTX_FLAG_RAW, etc.). Dialects test with>=, never==, and unknown flags are safely ungranted rather than triggering legacy fallback. -
Per-Batch Line Reporting (
batch_lines): Context structs now report the exact record count within the batch (wc -ldelimiter semantics) alongside byte lengths. -
Lossless UMA Sequence Mapping: On UMA hardware,
numa_batch_idis now derived directly from the authoritative 64-bit claim index, eliminating the legacy$2^{22}$ minor-index wraparound and establishing the identitynuma_batch_id == batch_index. -
Byte Packing Alignment: Internal configuration state slices (
cfg_state[4]) are now strictly ordered:[0]=cfg_w,[1]=cfg_l,[2]=cfg_b, and[3]=flags. -
Zero-Copy
mmapStability Guarantee: The memory window[batch_offset, batch_offset + batch_byte_length)infd_inis guaranteed immutable and stable during callback execution, enabling zero-copy mapping (NumPy / Apache Arrowfrombufferpattern).
3. Adversarial-Resistant Resume Sandbox & Atomic Publication
Resume files (.forkrun_resume) dictate what commands and environments an orchestrator executes upon restart. In shared multi-user scratch environments (such as Lustre or /tmp), an unhardened resume parser is a vector for arbitrary code execution.
v3.5.0 introduces a formal 3-Layer Defense-in-Depth Security Model:
- Layer 1 (Provenance & Permission Gate): Inspects the file descriptor before execution. Foreign-owned files or files with group/world-writable bits (
8#022) are soft- or hard-rejected; unattended runs fail closed. - Layer 2 (The Restricted Cleanroom): Variables are extracted inside an
env -i PATH=''restricted subshell (bash --norc --noprofile --restricted). Functions are captured and completely wiped before variable serialization; variables are re-rendered viadeclare -pand round-trip verified (rejecting dynamic command substitutions). - Layer 3 (Authorization Decision Gate): Variables and function text cross in separate token-bounded frames (
_secret_token/_fn_token). Function text and custom setups are quarantined until the user grants explicit confirmation on/dev/ttyor assertsFORKRUN_TRUST_RESUME=1. - Atomic Publication: Checkpoints are published via temporary sibling files and renamed atomically (
mv -f), guaranteeing readers never observe torn fragments during mid-flight crashes.
4. Closed Hydraulic Backpressure (H3) & Emit Fallbacks
- The 4 KiB Hydraulic Ack Pipe: The worker-to-orderer acknowledgment pipe has been resized from 1 MB to exactly 4 KiB (1 page). When downstream output stalls (e.g., slow terminal or saturated network disk), the orderer blocks, the ack pipe fills instantly, workers stop claiming, the ring fills to the shield boundary, and Ingest blocks. Pipeline memory usage remains strictly bounded with zero userspace flow-control protocol overhead.
- Zero-Copy Fallback Cascade (
forkrun_emit_with_fallback): Fixes a critical edge case wheresendfile()on files opened withO_APPEND(>> redirect) returnedEINVAL, which previous versions misinterpreted as a clean EOF. The orderer now detectsO_APPENDup front and falls back seamlessly to chunkedread/writecopies on any zero-copy failure.EPIPEis strictly separated as the sole clean-exit condition.
5. 64-Bit Coordinate Space & Multi-Node Safety
-
64-Bit Chunk Majors: Major chunk IDs are now full 64-bit scalars throughout the C engine, packed with 42 bits for major chunks and 22 bits for minor batches (
PACK_KEY). This allows pipelines to ingest petabyte-scale datasets without sequence key rollover. -
Topological Safety Ceiling: Oversubscribed node mappings (
--nodes=@N) are capped at$N \le 512$ (reduced from 1024), providing a mathematical guarantee that claimed-in-flight and gated chunks cannot wrap the 4,096-slotmeta_ring. - Frozen Seqlock Ledger Snapshot: Scanners in resume mode now take a frozen, sorted, Seqlock-consistent snapshot of the jagged completed intervals once at entry, eliminating shared-cache contention and tearing hazards during high-frequency slot flushes.
🛠️ Additional Improvements & Bug Fixes
- Coordinated Signal Shutdown:
SIGTERMand SLURM preemption signals (SIGUSR1,SIGXCPU) now route through the reactor's abort choreography, ensuring workers are reaped and the Seqlock ledger is frozen before the crash checkpoint is committed to disk. - NUMA Ingest Fallback Probe: Fixed an accounting leak during ingest probe transfers when
set_mempolicyis disabled viaFORKRUN_DISABLE_MEMPOLY=1(A1). - Fallow Failure Propagation: Abnormal termination of the background hole-punching fallow process now triggers the global fire alarm (reason 2), preventing silent output truncation (A2).
- Worker Incarnation Disambiguation:
{ID}string substitution now appends a.r${INCARN}generation suffix upon worker respawn, preventing output file collisions during retry episodes. - Input Delimiter Normalization: The delimiter search heuristic correctly handles files without trailing newlines, ensuring trailing records are never dropped.
- OOM Memory Sensing: System memory pressure sensing now accurately inspects cgroup v1 (
memory.limit_in_bytes) and cgroup v2 (memory.max) constraints alongside physical host RAM.
📊 Verification & Empirical Testing
The v3.5.0 engine has been validated across a comprehensive stress and verification matrix:
- 345+ Passing Unit Tests: 100% green pass rate across
test_frun.sh(91/91),test_frun_comprehensive.sh(254/254), and the native C plugin test harness (including the new 5,000,000-batch UMA monotonicity proof). - Full Topology × Sanitizer Matrix: Passed across both flat UMA and multi-node NUMA (
numa=fake=4), validated with GCC/LLVM ThreadSanitizer (TSan) and AddressSanitizer + UndefinedBehaviorSanitizer (ASan/UBSan) with zero memory leaks, zero alignment faults, and zero data races. - Sustained Throughput: 396 empirical benchmark runs over 30 billion lines sustained 90%–98% aggregate CPU saturation across 28 hardware threads, with peak streaming reaching >800M lines/s in stdin mode (
-s) and >4.6 GB/s in byte mode (-b 524288).
📦 Upgrading
forkrun remains distributed as a zero-dependency, single-file Bash script with an embedded multi-architecture binary payload (x86_64 v2/v3/v4, aarch64, ppc64le, s390x, and riscv64):
# Direct download
wget https://raw.githubusercontent.com/jkool702/forkrun/main/frun.bash
source ./frun.bash
# Or source directly via curl
source <(curl -sL https://raw.githubusercontent.com/jkool702/forkrun/main/frun.bash)Existing CLI invocations and functions are 100% backward-compatible. Plugin authors compiling against forkrun_plugin.h should update to the 128-byte layout and verify that dialect checks use ctx->version >= 2.
Full Changelog: v3.4.3...v3.5.0