Convert ActorCollection to standard coroutines - #13836
Conversation
ActorCollection to standard coroutines
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
tclinkenbeard-oai
left a comment
There was a problem hiding this comment.
Generated by Codex.
What is it trying to do?
Convert ActorCollection from an actorcompiler-generated actor to standard C++ coroutines while preserving its public API, event ordering, deterministic cancellation, error propagation, accounting, and sampling lineage.
Is it correct?
Yes. I compared the replacement runtime against the previous implementation and inspected child ownership, synchronous callbacks, completion ordering, returnWhenEmptied, cancellation and error propagation, nested clear(), counter and timing updates, sampling lineage, and the shared NoThrowOnCancel change.
The cancellation state is latched before waiter or frame teardown, runtime destruction prevents reentrant callbacks from accessing invalid state, nested clear() cannot create duplicate stream consumers, and callback lineage explicitly restores the actorCollection name. Added regressions cover cancellation order, reentrant cancellation, sibling completion and errors during teardown, queued-ready actors, stream errors, and sampling.
The sole failing check, FoundationDB CI - PR Builder, compiled successfully and passed all 62 CTests, but its Joshua campaign passed 9,998/10,000 simulations. Both failures were tests/fast/DDPipelineSaturation.toml, with seeds 925654854 and 1246470200. The same PR head passed 10,000/10,000 simulations under Clang, and the immediately preceding commit passed 10,000/10,000 under GCC; the current commit adds only five comments. The workload and relevant data-distribution/recovery sources are identical to the PR base, and separate PR #13778 addresses this failure class. This strongly suggests an existing data-distribution issue rather than an ActorCollection regression, although exact-seed causality has not been proven.
No builds, tests, or simulations were run for this review.
Are there bugs?
I did not find any correctness bugs in the current PR.
Are there omissions?
No blocking omissions. Explicit regression coverage for idleTime/allTime accounting and reentrant cancellation during waiter detachment would strengthen coverage, but the existing implementation preserves those accounting transitions and latches cancellation before waiter teardown.
Are there better ways of doing things?
No substantial alternative is necessary. Persistent callbacks and the intrusive completion queue preserve constant-time common-path processing, while the ready-actor fast path avoids allocating an unnecessary Runner.
Should this CL be LGTMd?
Yes, LGTM for the reviewed code. The failing GCC builder remains a merge gate and should be rerun or otherwise resolved before merging.
…orcollection-coroutines-20260810
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
saintstack
left a comment
There was a problem hiding this comment.
Both failures were tests/fast/DDPipelineSaturation.toml, with seeds 925654854 and 1246470200.
Hopefully fixed by 'Bound the post-move destination metrics refresh in DD (#13863)'
For 'RandomSeed="2364947726" SourceVersion="dbd9b0fbdc0f7053a1dfccabd97c3d10478966f2" Time="1786727684" BuggifyEnabled="1" DeterminismCheck="0" FaultInjectionEnabled="1" TestFile="tests/fast/ShardEncodeRollback.toml"', let me take a look at this one..... It seems unrelated.
|
Local LLM came back with following... I'd be interested in your comments on 2 and 3 in the below. Code review: Convert
|
This comment has been minimized.
This comment has been minimized.
Result of foundationdb-pr-clang-ide on Linux RHEL 9
|
This comment has been minimized.
This comment has been minimized.
Result of foundationdb-pr-clang-arm on Linux RHEL 9
|
Result of foundationdb-pr-clang on Linux RHEL 9
|
Result of foundationdb-pr-macos-m1 on macOS 14.x
|
Result of foundationdb-pr on Linux RHEL 9
|
Result of foundationdb-pr-cluster-tests on Linux RHEL 9
|
Result of foundationdb-pr-macos on macOS 14.x
macOS stat flags, not linux compatiblelock_mtime() { stat -f %m $LOCK || echo 0 }
|
Summary
ActorCollection.actor.cppinto a standard C++ coroutine implementation inActorCollection.cpp.Benchmark results
flow_bench; Clang 19.1.5; Release build; sanitizers disabled; pinned to one CPU; seven repetitions; 0.15-second minimum benchmark time.Testing
flow_test -f /flow/actorCollection/ --seed 12345: 12 passed.flow_test -f /flow/coro/noThrowOnCancel/ --seed 12345: 7 passed.flow_test --ignore /flow/coro/FlowMutex --seed 12345: 189 passed; excludes an unrelated long-running mutex stress test.flow_test -f /flow/actorCollection/testSamplingLineage --seed 12345withENABLE_SAMPLING: 1 passed.flow_benchandflow_sampling, including the sampling-enabled implementation.clang-format19.1.5 check passed.