Repository navigation
State_exec locks L1b: the spawn context on one scheduler (in progress) - #865
Merged
Merged
Conversation
… the locks deep workflow The state_exec lock work (docs/STATE_EXEC_LOCKS.md) adds code that runs on several threads, and no CI lane ran a race detector or an address checker. This lands them before any lock code, so that the races and leaks already in the tree get a baseline first. - ci.yml `sanitizers` (tsan, asan-ubsan): gcc's -fsanitize=thread, or -fsanitize=address,undefined, over libcvc itself (the cvcpkg deps stay uninstrumented), RelWithDebInfo, building only the targets it runs. It runs the existing suites that use threads (state_exec_scheduler, _async, _integration and _coordinator tests, ariadne_runtime_test, thread_pool_test, async_lane_test) and pycvc's exec scripts, with the sanitizer runtime preloaded into the interpreter. Suppressions go in .github/sanitizers/, each with a comment naming what it hides. Each lock phase appends its suites. - ci.yml's pull_request filter takes perf/** as well, so the lock phases' stacked drafts get the full set of jobs. - locks-deep.yml (daily, and by hand on a branch): a Release Linux build of the lock test targets, running their deep sizes. A dispatchable workflow must be on the default branch, so it lands first; on a ref without the lock tests it stops after the checkout.
…s, gate, and policy/locks sweep keys The state_exec lock phases decide their gates with the bench, and the design's gates need things compare could not do: two points of one run against each other, absolute bounds, a noise rule that refuses to judge a disturbed run, and a rule under which a drop in steps_total fails. tools/bench/state_exec_bench.py: - key_of leaves out a param at its implicit default (policy=rr, locks=none), so records from binaries without those keys still match. - compare --pair KEY=A:B compares the base's points at A with the candidate's at B, matched without KEY (both may be one run). - compare --max-noise P: a point noisier than P% is INCONCLUSIVE (exit 2, "repeat in a quieter window", never a pass). - compare --fail-on-change: any change beyond the noise fails, in either direction, for steps_total. - gate RUN --scenario --metric (--max|--min) [--stat] [--where] [--max-noise]: absolute bounds on one run. state_exec_bench: sched.single.*, flood.small and msg.* take two sweep keys, policy (rr, priority, priority_rr) and locks (none; the lock phases add private and shared, and a build without them skips such a point). A default run measures the same points as before, plus the two params at their defaults. tools/bench/test_state_exec_bench.py tests the rules on synthetic records; CTest runs it as state_exec_bench_tool_test when a working Python 3 is found.
Atomic single-node updates for the DSL's state-cas, state-swap and state-incr (docs/STATE_EXEC_LOCKS.md 4.4). Each compares, or computes, and assigns under one hold of the written node's mutex, then fires valueChanged and the parent's child signal with no lock held, only when the value changed. They write the node a read through a transparent link sees: a writable transparent link writes its target, as value(v) does. Unlike value(v), a transparent link that is not writable, or cannot be resolved, throws read_only_error rather than taking the write on the link node, so a compare and its write are always on the same node (gap G-7). Three non-virtual members and one private helper, so state.h stays source- and layout-compatible. pycvc wraps compareAndSetValue and exchangeValue; updateValue takes a std::function and is %ignore'd.
…-incr detail::read_number_text reads a token as the DSL does: the whole token as an int64, else as a double (strtod, for a token that may be one). The parser's parse_number_or_symbol now calls it, unchanged in behaviour, and state-incr will read a node's text with it, so both agree on what a number is (gap G-9).
The atomic natives of docs/STATE_EXEC_LOCKS.md 4.4, each one native call over cvc::state's atomic members: - (state-cas path expected new): #t when the value equalled `expected` and is now `new`. A nil expected matches an absent or "" node; an absent node is made only then. - (state-swap path new): the value it replaced, nil when absent or "". - (state-incr path [delta]): the new number. The node's text is read as a DSL number (detail::read_number_text); an absent or "" node is 0; anything else is a ValueError and the node is left as it was. int + int stays an int (an overflow is an ArithmeticError, gap G-11); otherwise the sum is a float, stored in its shortest round-trip form. Each resolves its path under the chroot and through a transparent link as state-get reads it; nil is "", a list or dict is a TypeError. A change fires watches and valueChanged once; an equal write fires nothing. Floats are written with std::to_chars where the library has it, else by detail::format_number_shortest_fallback, which writes to_chars's exact text (shortest round-trip digits, fixed or scientific, the exact digits of a whole number in fixed form). It is built everywhere, and a test checks it against to_chars byte for byte (gap G-10). Tests: state_exec_locks_test (new; the Atomics suite AT-1..AT-13 on both schedulers, AT-6's two-thread updateValue, the formatter against to_chars on a table and 20000 values; the locks_world fixture the lock phases reuse), and test_pycvc_state_exec_locks.py. Both join C0's sanitizer jobs.
state-incr and state-cas timed against state-set by the native.* method, on a node 1 or 4 levels down that starts at 0 and must end at n: op=set is (state-set P (+ i 1)), op=incr (state-incr P), op=cas (state-cas P i (+ i 1)), which succeeds and writes every time (gap G-8). Its gate, a paired one: incr and cas each at most 1.1x set in extra.ns_per_call (docs/STATE_EXEC_BENCH.md).
The developer guide's DSL state section gains state-incr, state-cas and state-swap: paths and links, absent nodes, nil, number text, signals, and which tool to use when. Ariadne's reactive lane does not bind them (they write). STATE_EXEC_LOCKS.md's status: L0 built.
…nager's interface Phase L1's interface commit (docs/STATE_EXEC_LOCKS.md, locks plan L1.1 and I1). - Three built-in exception classes: LockError (a RuntimeError), DeadlockError (a LockError) and PermissionError (an Exception), with BuiltinClasses.LockClasses and their rows in STATE_EXEC_EXCEPTIONS.md 2.3. - lock_manager.h (public): lock_mode, lock_threading, lock_info, lock_waiter_info, lock_query_result (gap G-13), lock_stats in full (gap G-35), and lock_manager, a pimpl over the table. Shared mode throws until phase L3; CVC_STATE_EXEC_CHECK=1 forces self-checks on (gap G-4). - detail/lock_table.h: the protocol's operations (sections 4.4-4.15), one member each; the request, key-cache and notification types; the trie node's layout; lock_violation; the test-only mutation bits the model check needs; the test hooks, reached through exported functions (gap G-4); and the canonical dump's format, which the real table and the model test's spec oracle both write. The table's operations are stubs that throw until L1.2.
The process carries the lock home's private state (protocol 2.2): `locks` (null until the process first locks), `lock_waiting`, `lock_deadline`, `inherited_priority` (written only by a relevel, phase L2), `lock_expired_pending`, and `effective_priority()`. The process table counts lock waiters (the sync scheduler's has_runnable will read it) and keeps a lock wait's deadline as a timer. wake_due hands an expired lock wait to the lock home instead of readying it: appended to the caller's vector, or, with none, flagged and counted for take_lock_expired, so a flagged waiter is collected by the next wait_expired (design 8.7). The spent deadline leaves the heap for good. The run-queue level goes through level_key(), which phase L2 switches to the effective priority. check() covers the new counts and flags. Tests: ProcessTableTest.LockDeadlineIsClearedAndNotRepushed, LockExpiryWithoutVectorIsFlaggedAndCounted, TakeLockExpiredCollectsFlagged, WakeDueCountsUnchangedWithoutLockWaiters, CheckSeesLockWaiters.
The home actions of protocol section 5 (docs/STATE_EXEC_LOCKS_PROTOCOL.md), in detail/lock_home.h and lock_home.cpp, and the hooks both schedulers give them. No DSL reaches a home yet (with-lock is bound in the next commit), so every existing path is unchanged: process::locks stays null and every hook tests it first. lock_home: - the mirror (mhold, process_locks) and the private state of protocol 2.2; - try_enter: the handler rule, the upgrade refusal and covered requests on the mirror, then the fast path, with the mirror's slot reserved before the grant; - wait, collect and apply_wake (the outcome kept in the lock_enter frame); - release_frame with its defensive withdraw, process_ended, wait_expired (adopting a grant that beat the timeout), set_base, deliver; - the key cache (design 8.4): a fixed array of entries indexed by (scope, key as written), CLOCK eviction that never takes the request's own entries, each entry one key-cache reference of the home, the reference taken by the request's own table call; - check_quiescent: the home-side clauses of I2, I3, I4, I6 and I8's base clause; the destructor detaches and clears every process's lock fields. Schedulers: set_lock_manager, locks() (a private manager on first use), check_tables(), a destructor that drops the home first; the end hooks in terminate/kill/fail_process before on_complete; lock expiries collected inside the existing timer branch (a program with no timer pays nothing); the sync scheduler's has_runnable counts lock waiters; fork refuses a holder and copies owner (td B28); restore clears every lock field; set_priority keeps the manager's base (I8). scheduler_base gains locks() and check_tables() as non-pure virtuals. eval_phase gains lock_enter and lock_body (pycvc's enum and the codec's names with it), with stub steps until the next commit; evaluator_state gains in_generator. lock_table declares the read-only views the home's checks use; their bodies come with the table (L1.2).
Implements detail::lock_table, the manager of docs/STATE_EXEC_LOCKS_PROTOCOL.md sections 2-4 and 6, one member function per protocol operation, observationally identical to tools/locks_model/lockmodel.py's Manager: same results, the same notifications in the same order, the same state. The structures are those of protocol 2.4. A path trie holds one node per key with a hold, a queued ticket, an abandoned flag or a key-cache reference, and every proper prefix of such a key; each node keeps the holds and queued tickets on its key and the subtree counts sub[m] and subw. Conflicting holds and waiters are found by the root-to-key walk and a descent guided by those counts, never by a scan of every hold or ticket. The queue is an intrusive list in seq order. Records, holds and tickets come from slot pools found through open-addressing indexes, and a record goes back to its pool as soon as its process has no hold and no ticket, so an uncontended try_acquire and release on cached nodes allocates nothing once the pools have grown. The owner is copied only when a record is made. Trie nodes that may have emptied are freed when the operation ends, so a region being re-examined stays valid. re_examine collects the queued tickets that overlap the region through the trie, tests them in seq order and posts a wake for each grant, and does nothing when no queued ticket overlaps. block detects deadlock exactly by reachability from its blockers, and its cycle is the depth-first path the protocol specifies, with each edge's key captured as an absolute string and a pid shown only for a process of the requester's home and owner. query, the key-cache references, detach_home, the counters of lock_stats and the canonical dump are all here. Phase L1 has no inheritance: relevel_all is the protocol's "lending false before and after" case, and attach_home refuses a priority home while inheritance is on. Before L3 a manager accepts one home. With options::self_check on, check() runs after every operation and asserts the manager's clauses of section 6 from their definitions, recomputing every trie count; each grant asserts I1, I5 and I15, and each grant test compares the trie's enumeration with the definition. Debug builds assert the single-mode owner-thread token on every call. The test mutations change the behaviour exactly as the model's do, and plant_divergence leaves the first grant a release makes out of the grants count. lock_table also gains read views of a record, a ticket, a hold and a home's key-cache references, for lock_home's quiescent check. The LockTable suite drives the table directly on one home: the manager-level shapes of LK-3, LK-4, LK-8, LK-19 to LK-22, LK-25 to LK-28, LK-32, LD-1 to LD-4, LD-7, LD-9 and LD-10, emptiness after every end and after a detach, key-cache references, query, abandoned-flag conservation, the canonical dump of known states, the counters, and every mutation.
Locks plan L1.6-L1.11 (docs/STATE_EXEC_LOCKS.md 4.1, 5, 8.5; protocol 5).
- lock_intrinsics.cpp binds with-lock (a lock_ops object: the context it was
registered with), locks-held, lock-query and %lock-wait, and resolves keys
as written: segments trimmed, empties dropped, '' or '#' a ValueError, a
leading '/' app-global where a '/' channel is allowed (else PermissionError,
gap G-15), anything else under the chroot. register_intrinsics calls it.
intrinsics_context gains lock_default_timeout and lock_wait_allowed.
- The stackless evaluator recognizes the form by its binding (a user's
defun, macro or set of the name wins). Options are read first, so a bad one
is a ValueError before the manager sees anything (I13). KEY and :timeout are
inline when literals or symbols. The frame's layout is made before the
grant, :as scope and value included, and the grant only fills them in; the
fast path costs the steps of (begin ...). Busy: :if-available runs :else
holding nothing; a :timeout of 0 or a context that forbids waits raises
TimeoutError; otherwise the frame waits in lock_enter on a %lock-wait child,
applied through the frame's own lock form with the lock-enter token armed.
Every unwinder (unwind_exception, unwind_jump, fail_step) releases a lock
frame before it pops it, so the order with finally is LIFO. A generator's
state refuses (LockError "generator"); a step outside a process refuses
("no process").
- A restored waiter's wait is applied again through the lock form below it,
re-resolved from with-lock in its environment (gap G-41); none there is a
LockError "restore" (gap G-44).
- The codec: the lock_ops binding is skipped like a native and rebound by
rebind_natives; a lock_ops value has no payload and decodes as nil; a lock
wait's handle is written as nil (gap G-1); the lock phases have names; a
holder's snapshot is refused, naming its keys (gap G-16); a parked waiter's
TIMEOUT is written as what is left of it.
- restore refuses a stack holding a lock (LW-12).
- The recursive evaluators refuse with-lock (TypeError "with-lock needs a
scheduler").
- (fork) forks the running process (td B28) and refuses inside with-lock.
- process_info gains locks_held and waiting_on ("lock /key", "msg c",
"sleep", "frame"); inspect shows them, a lock key relative to the caller
(gap G-17); pycvc's process_info has both.
- builtin_generator marks its state in_generator.
- app::lock_manager(): the app's with-lock table, made on first use (single mode in phase L1); exec_scheduler() attaches its home to it when it builds the scheduler (design 8.4). - Ariadne: the init lane never waits for a lock (a busy request is as :timeout 0), and an action's with-lock with no :timeout gives up after ariadne.exec.lock_timeout seconds (default 1.0; design 14.2 Q1).
# Conflicts: # inc/cvc/state/state_exec/detail/lock_table.h # src/cvc/state/state_exec/lock_manager.cpp
A first pass over the lock form: a section's value and locks-held, a waiter parked and granted on release (inspect's waiting_on), a deadlock raised in the request that closes the cycle, a timeout (never early), :if-available and :timeout 0, the option errors, a covered nested request, the upgrade refusal, and :as. The locks_world fixture gains step_until, and run() waits for its own process only.
…ntext fields A with-lock binding registered from Python is a lock_ops copy that keeps the intrinsics context and its Python owner alive (LK-23); it stays a lock_ops object, so the evaluator and a restored wait still find it (gap G-41). intrinsics_context exposes lock_wait_allowed and lock_default_timeout (a float or None).
…model suite in the sanitizer jobs state_exec_wasm_smoke (CVC_BUILD_STATE_EXEC_WASM_SMOKE, off by default) is a plain main() that runs a section, a holder and a waiter granted on release, and an empty lock-query on both schedulers, and prints STATE_EXEC_WASM_OK. ci.yml's ari-wasm job, which builds without pthreads, builds and runs it under node and fails unless it exits 0 with the marker; its path filter now includes the state directories, so a lock-only PR still runs the job (locks plan L1.12, R-7). state_exec_locks_model_test joins the sanitizer jobs.
The developer guide gains a section on with-lock (the form and its options, keys and chroots, waiting and where waits are refused, release, abandoned, deadlocks, the reads, fork and snapshots, the hosts), a note that with-lock is a soft form, and DSL (fork). STATE_EXEC_EXCEPTIONS.md: a kill releases locks without unwinding; holders can't be snapshotted, waiters requeue. STATE_EXEC_GRAMMAR.md: with-lock needs no grammar. ARIADNE.md: the reactive lane has no with-lock, actions' lock timeout, the init lane never waits, actions' fork. The protocol's and the design's status lines, B28 landed, and pycvc's lock context fields.
Declarations and stubs that L1b (spawn contexts) and L2 (priorities) build on, per the locks plan's joint interface commit: - execute_options: keep_alive, priority_floor, parent_pid; process keeps them (execute() copies the floor, its explicit flag, the parent and keep_alive). - process_info effective_priority and priority_floor; scheduler_stats priority_clamped. - priority_info, priority_change, control_cmd, policy_from_state, and the scheduler_base priority virtuals with default bodies; both schedulers override them with stubs (get_priority and set_priority_floor are real) and declare post_control (a stub). - intrinsics.h: spawn_setup, intrinsics_context::spawn_context, and make_spawn_context (a stub returning no callback). - detail/priority.h: declarations only. No behaviour changes: every existing suite passes.
The model check of locks plan L1.3, test LT-5, written from docs/STATE_EXEC_LOCKS_PROTOCOL.md and tools/locks_model/ rather than from the table's code. state_exec_locks_model_test.cpp ports lockmodel.py's Manager as a spec oracle, world.py as a world of homes, processes, frames, key caches and posts, and explore.py as a 0-1 BFS explorer over fingerprints of the world's state. Every manager operation runs on the oracle and on the real detail::lock_table, driven as a lock home drives it (cached nodes, references taken on a miss, evictions); the results, the notification lists and the two canonical dumps must agree before both check()s and the world's home-side and transition invariants run. States over the real table are rebuilt by replaying their paths. On the oracle alone and with the Python model's FIFO cache, the explorer reproduces explore.py's counts of states and transitions for l1, for l1 with signals and foreign calls, and for the two-home core configuration; the default cache pins a request's own entries as the implementation does. Suite LocksModel has the bounded exploration, random runs, the scenarios of scenarios.py that L1 can run (LX-10 and LX-11 on two homes), the eight L1 mutations, each reporting exactly its violation, the replay of the Python model's traces, and a divergence planted in the table that the lockstep must catch. Suite LocksModelStress has the deep sizes. tools/locks_model/export_traces.py writes those traces, committed under src/cvc/tests/data/locks_model_traces/, and the model's README describes the C++ check, its sizes and the measurements behind them.
…ess keeps alive L1b.1 of the locks plan (td 4.15). spawn now gives the child its parent's owner, always, so a host's kill_owner reaps it with its parent. When the host installed a spawn_context, the child also gets the environment and context that callback makes. The context rides in execute_options::keep_alive and lives as long as the child's process object. Without a callback the child keeps the bare builtins, as before. make_spawn_context is the ready-made callback for hosts that call plain register_intrinsics. Each child gets a context copying the parent's scheduler, root and chroot, tracker, identity, channel policy, document, lock fields and the callback itself, so grandchildren get one too. It also gets environment::extend(base) with the intrinsics registered, then the host's after_register bindings. SpawnContext tests cover the bare env, the chroot and channel key, the owner (kill_owner), the context's lifetime (reap), grandchildren, the copied fields and after_register.
L1b.3 of the locks plan (td 4.15). An Exec now keeps its builtins, intrinsics and registered functions in a natives scope, and runs programs in environment::extend(natives). Top-level definitions still persist across run(). Its context's spawn_context gives a spawned child extend(natives) too, so the child calls the Exec's registered functions; before, it got the bare builtins. The Exec's own context serves the child: on one scheduler the intrinsics act for the running process. test_is02_spawned_child_calls_registered_function covers IS-2.
A parent chrooted at doc, whose context installs make_spawn_context, spawns 8 children. Each runs 1000 sections of state-incr and a read-modify-write that sleeps inside with-lock "q". On both schedulers doc.q.n and doc.q.m come to exactly 8000, nothing lands under the root's q, and the manager counts the waits (7999 here).
… the grant
LX-8 (Locks.LX08_ErrorsBeforeAndAfterTheGrant) injects an error into the step that
grants a with-lock at once, through lock_test_hooks::after_grant. The hook ran inside
lock_home::try_enter, right after the grant joined the mirror and before the frame
became lock_body with its hold id. fail_step then popped a frame that was still in its
init (or key-evaluating lock_enter) phase, so release_lock_frame found nothing to give
back: the hold outlived the failed step, the program went on holding the lock after
catching the error, and only the process's end released it (counted as leaked at exit).
The hook now runs in stackless_evaluator::lock_acquire once the frame records the grant,
the point the plan's risk note names ("the frame becomes lock_body with its hold id
before the body frame is pushed"), so the failed step's unwind releases it. The call in
collect (a grant after a wait) is unchanged.
…looks ASan's leak check failed state_exec_locks_test on 189 indirect leaks: default environments held by a closure bound in the scope it captured, a cycle only collect_cycles() frees. The tests step the schedulers by hand, so nothing ever collected. A gtest global environment now runs collect_cycles() at the end, when every world is gone, so the leak check sees only real leaks.
…e fits CI - home_world::request() built its KEY value as a local, and build_request keeps views into it, so try_enter read freed memory. TSan reported it, and on macOS and Linux it turned LockHome.EvictionAndRefs's keys into garbage. MSVC's stack happened to keep the bytes. The values now live as long as the world. - LK-18 checks every invariant after every step. A CI runner manages about 25 operations a second on the default cache, so 10,000 didn't fit its 240 s. The regular Release size is 3,000; LocksStress keeps the deep sizes.
# Conflicts: # src/cvc/tests/state_exec_locks_test.cpp
The before-terminate hook passed a temporary value_t to build_request, whose request views the key's text; ASan caught the read after the temporary died (LX06). Also move LK-18's sizing comment above the sanitizer branch, which clang-format otherwise indents as part of it.
…ug at 500 run.sh ran each sanitizer binary whole, so the TSan job ran LocksStress's four 10^5-operation cases (about 23 minutes each under TSan) and hit run_one's hour (#862: exit 124, no report). It now passes -*Stress*, as ci.yml's STRESS_REGEX keeps those suites off the PR lanes; locks-deep.yml runs them. Its LocksStress filter named LocksStress.*, which matches none of the parameterized Schedulers/LocksStress.* tests: fixed. LK-18's regular size in a Debug build was 2000 operations, 150-240 s on CI runners against ctest's 300 s, and over it on a loaded one (#862's package-linux debug-grpc). Release does 3000 in 5-13 s; Debug is 25-50 times slower, so it now runs 500.
… for idle wait_pool_idle read getActiveThreadCount() and then getPendingThreadCount(), each under its own lock. A worker could take the last queued task between the two reads, so the pool looked idle while that task ran: AppPoolKeyed.AKeyedTaskWithRoomIsRegisteredOnReturnBehindAnonymousTasks saw 7 of 8 warm-up tasks done (#868's ubuntu Debug run). A task leaves the queue and counts as running under one lock and stops counting after its body, so reading the queue first can't miss one.
transfix
marked this pull request as ready for review
October 30, 2026 03:45
transfix
added a commit
that referenced
this pull request
Oct 30, 2026
transfix
added a commit
that referenced
this pull request
Oct 30, 2026
…-tick The locks spawn context (#865) makes resident contexts shared and built by make_action_context: a mount's tick resident is made the same way, chrooted to its sub-prefix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is phase L1b of the state_exec locks plan: the spawn context on one scheduler (
docs/STATE_EXEC_THREADED.md4.15,docs/STATE_EXEC_LOCKS.md5.8). It stacks on #862 (L1). It is a draft and still in progress; it is up now so Linux, macOS and wasm CI can check the code early.A spawned child used to get the bare builtins and no owner. Under a host that installs a spawn context, it now runs like its parent: it gets the intrinsics (so
with-locktoo) under the parent's chroot, and it keeps the parent's owner, so the host reaps it with the parent.In so far
execute_options::keep_alive,priority_floorandparent_pid;processandprocess_info;priority_info,priority_change,control_cmdandpolicy_from_state;scheduler_basepriority virtuals with stub overrides, andpost_control(a stub);spawn_setup,intrinsics_context::spawn_context, anddetail/priority.h(declarations only).spawnandmake_spawn_context:spawncopies the running process's owner to the child, always.spawn_context, the child gets that callback's environment and context. The context lives as long as the child's process object (execute_options::keep_alive).make_spawn_context(base, after_register)is the ready-made callback for hosts that register the plain intrinsics. Each child's context copies the parent's scheduler, root and chroot, identity, channel policy, document, lock fields and the callback itself, so grandchildren get one too.has?, and its parent's lock default.init:script's child gets the intrinsics too, and never waits for a lock.spawn_setupgains an optionalspawned(pid)callback.Execkeeps its intrinsics and registered functions in a natives scope under the programs' own, and its children extend that scope, so they call the registered functions (IS-2). Top-level definitions still persist acrossrun().SpawnContext.*: 7 cases covering the bare env, the chroot and channel key, the owner (kill_owner), the context's lifetime, grandchildren, the copied fields, andafter_register;with-locksections under the parent's chroot, on both schedulers. The counts come out exact and the manager counts the waits;ariadne.exec.lock_timeoutat 30 it still waits after 2 s), LW-9 (an init script's child getsTimeoutErrorat once, not after its 30 s), andSpawnContext.FinishedChildIsReaped.lock.handoffgainsworkers=spawn, where one parent spawns the workers. Handoff rates matchworkers=hostwithin this machine's noise, andfairness_spreadis at most 1 on both.make_spawn_context(developer guide); the pycvc README and parity doc; B27's single-scheduler part in the threaded design; the locks status.td 5's spawn scan.
git grep "(spawn"finds no.aridocument. The pycvc tests spawn"(while t 1)", which needs nothing from its environment. The C++ suites' schedulers install no callback, so their children keep the bare environment. No caller relied on the bare builtins.Run locally (Windows, MSVC, Release): every
state_exec_*suite,state_test,ariadne_runtime_test,app_testand the pycvc state/exec scripts pass. Existing results are unchanged.Still to come in this PR: