Skip to content

v3.6.2

Latest

Choose a tag to compare

@jkool702 jkool702 released this 05 Nov 20:22

What's Changed

Overview

forkrun v3.6.2 is a substantial update focused on Python execution isolation, process supervision, streaming efficiency, signal correctness, and release integrity.

The Python frontend has evolved from a collection of execution paths into a more consolidated architecture with explicit lifecycle ownership, stronger failure semantics, bounded streaming behavior, and a dedicated cleanroom execution environment. The release also makes the Python UDF route a properly packaged, per-interpreter feature rather than relying on locally built helper artifacts.

Cleanroom execution and process isolation

The exec-based cleanroom launcher is now the default execution route for map(plugin) when FORKRUN_CLEANROOM is unset.

This moves plugin execution out of the parent Python process and into a separately launched environment, reducing the memory and dependency footprint inherited by the worker execution path.

Key changes include:

  • map(plugin) cleanroom execution is enabled by default.
  • FORKRUN_CLEANROOM now supports explicit route selection, including opt-in subsets and a compatibility switch to disable cleanroom execution.
  • The launcher uses os.posix_spawn() rather than the previous fork-and-exec sequence.
  • File-descriptor relocation and ownership are hardened, including safe handling when standard descriptors are closed.
  • Helper registration, process supervision, descriptor cleanup, and fatal helper-death handling are consolidated into explicit contracts.
  • Cleanroom routing has expanded to support the dedicated multi-node NUMA plugin envelope when explicitly enabled.

Measured results include improved startup performance, higher throughput, and lower launch overhead for large parent processes. In particular, the posix_spawn() change reduced end-to-end launch time by 31.6% in the measured 2 GiB-parent case.

Python UDF execution and packaging

The Python UDF path now has dedicated compiled helpers for each supported GIL-enabled CPython minor.

The release provides wheels for CPython 3.10 through 3.15. Each wheel contains the helper built for its corresponding interpreter minor, with runtime version checks preventing an incompatible helper from being loaded.

Additional improvements:

  • Corrects cleanroom helper loading so ordinary CPython extension modules can resolve their required libpython symbols.
  • Loads the UDF helper with RTLD_GLOBAL, while retaining isolated loading for the disposable probe.
  • Makes mode="udf" fall back to the documented in-process execution path when the helper is unavailable or the requested cleanroom route is not selected.
  • Consolidates payload selection into one authoritative decision path.
  • Strengthens helper-version detection and the runtime typed-version barrier.
  • Adds installed-wheel acceptance testing that exercises real UDF workloads through the cleanroom launcher.

Free-threaded CPython remains unsupported by the UDF helper route; the generic substrate and in-process fallback remain available.

Signal handling and lifecycle correctness

SIGINT deferral has been redesigned around an explicit handshake between the signal recorder and the closing operation.

The previous boundary could race with an in-flight recorder or a process-directed signal still pending in the kernel. The new state machine uses explicit atomic transitions to prevent a signal from being attributed to the wrong generation.

Closing now:

  • Prevents new recordings from entering a closed generation.
  • Drains in-flight recorder operations.
  • Claims eligible kernel-pending SIGINT signals before restoring the host disposition.
  • Delivers captured signals synchronously on the closing thread.
  • Fails closed when signal restoration or lifecycle reset cannot be completed safely.

Python exposes these failures through DeferralError, while cleanup failures are prevented from silently replacing an exception already in flight.

Other lifecycle fixes include:

  • Closing internally opened source descriptors when resume initialization fails.
  • Centralizing helper-death decisions so an expected death during an existing abort does not trigger a second, misleading fatal error.
  • Consolidating C-drain and C-orderer teardown decisions.
  • Correcting poison notification handling so pending notifications are not lost during reactor shutdown.
  • Making poisoned_batches and its truncation indicator accurately reflect the available evidence.

Streaming, backpressure, and memory

The streaming paths receive several important improvements.

The C drain now integrates with the reactor's result notification mechanism instead of repeatedly waiting for fixed-size chunks. This removes a previous 16–19× performance cliff, bringing the measured path back to approximately 1.00–1.05× baseline.

Read-ahead is explicitly bounded by a consumer budget rather than allowing the pipeline to accumulate data merely because the underlying pipe has capacity.

The worker-completion notification pipe is also reduced from a 1 MiB queue to a 4 KiB window. This provides a tighter backpressure mechanism and reduces peak retained memory by approximately 24–65% in the measured plain-supervision workloads, without a measurable throughput or first-result penalty.

These changes preserve streaming behavior while making memory usage more predictable under slow consumers and high-amplification workloads.

Correctness, NUMA, and architectural consolidation

The release includes extensive correctness work across executor lifecycle, failure recovery, ordered output, and NUMA execution.

Notable improvements include:

  • Consolidating duplicated helper-death decisions across all execution paths.
  • Consolidating C-drain failure handling and C-orderer setup/teardown.
  • Preserving the NUMA configuration when creating the shared C orderer.
  • Strengthening per-node ingest, scanner, and recovery behavior.
  • Improving worker recovery and escrow routing across logical NUMA nodes.
  • Adding additional EOF, ordering, drain, recovery, and fault-injection coverage.
  • Fixing resume initialization so failed calls do not leak source descriptors.
  • Improving child-lifecycle test diagnostics so live children and unreaped terminated children are distinguished and attributed to the test that created them.

The architectural consolidation is intentional: shared behavioral rules now live in shared decision points rather than being duplicated across individual execution paths. Structural tests enforce that arrangement so future fixes are less likely to land in only a subset of the executors.

Release and distribution integrity

The Python distribution is now assembled as a validated release bundle rather than treating a green build matrix as sufficient evidence of publishability.

The official distribution set consists of:

  • CPython 3.10 wheel
  • CPython 3.11 wheel
  • CPython 3.12 wheel
  • CPython 3.13 wheel
  • CPython 3.14 wheel
  • CPython 3.15 wheel
  • One source distribution

Each wheel is built and installed-tested in its corresponding interpreter environment. The exact repaired wheel that passes acceptance is the wheel included in the release bundle.

Installed-wheel UDF acceptance receipts are bound to the SHA-256 of their respective wheels. These receipts provide durable evidence of the helper's compiled interpreter minor, including for repaired manylinux wheels where auditwheel removes the helper's libpython DT_NEEDED entry.

The bundle validator checks:

  • Exactly one wheel for each supported CPython minor.
  • Wheel tags, metadata, engine version, and glibc compatibility.
  • UDF helper symbols and per-minor acceptance receipts.
  • Consistency between the Python package files in the wheels and source distribution.
  • Absence of compiled binaries and launcher artifacts from the source distribution.
  • SHA-256 checksums and source-tree provenance.

The release pipeline independently validates the assembled bundle, verifies its checksum manifest, runs strict Twine metadata checks, and retains the complete candidate as a CI artifact.

Verification

The release candidate was verified through the following CI workflows:

  • Full Python test suite: 1,731 tests passed, 8 skipped.
  • Six per-minor UDF installed-wheel acceptance jobs: all passed.
  • Six Python-version compatibility jobs: all passed.
  • Bash compatibility matrix: passed across the tested Bash versions.
  • Basic and comprehensive Bash suites: passed.
  • Bash and Python AddressSanitizer/UndefinedBehaviorSanitizer and ThreadSanitizer validation: passed.
  • Release-bundle assembly, independent validation, checksum verification, and strict Twine checks: passed.

The final publication bundle contains six CPython wheels and one source distribution.

Upgrade notes

  • map(plugin) now uses cleanroom execution by default. Set FORKRUN_CLEANROOM=0 to restore the previous in-process behavior.
  • Install the wheel matching the target CPython interpreter; pip selects the appropriate per-minor wheel automatically.
  • The UDF helper route does not support free-threaded CPython; calls fall back to in-process execution when that route is unavailable.
  • The default output representation remains memoryview (output="view"); use output="bytes" when actual bytes objects are required.
  • No engine-level CLI breaking changes are introduced.

Versions: engine v3.6.2; Python frontend 0.18.0.

Full Changelog: v3.6.1...v3.6.2