6 minor findings · 7 suggestions
Earlier concerns neither republished nor resolved: 2 suggestions. See the Run archive for their assessments.
Findings
[minor] · Spawn's EOF handshake can wait for an unrelated notify process
A concurrent notify launch can inherit the error-report socket before FD_CLOEXEC is set, leaving an authenticated, IPC-backed echoipc call waiting for the unrelated process to exit.
Location: src/ipc/libmultiprocess/src/mp/util.cpp:355 (head).
Details and suggested fix
SocketPair() creates inheritable descriptors and sets FD_CLOEXEC afterwards. If a configured -blocknotify launch forks through system() during that window and preserves unrelated descriptors, its copy of error_fds[0] survives exec. Neither the parent's later fcntl nor the intended child's descriptor sweep closes that copy. After the intended child successfully execs, ReadSpawnResult() therefore keeps waiting for EOF until the unrelated process and any descendants holding the endpoint exit. Base already allowed IPC descriptor inheritance, but it did not have this synchronous error-channel wait. Create socket pairs with SOCK_STREAM | SOCK_CLOEXEC where supported, retaining a documented non-atomic fallback where necessary, such as macOS, and keep the child-side clearing for the IPC endpoint. The only current Core spawn caller is the hidden echoipc RPC; no production occurrence of this overlap has been identified.
[minor] · Error-channel allocation failure leaks the first socket pair
If the second SocketPair() fails under descriptor pressure, SpawnProcess leaks the two descriptors already allocated for IPC.
Location: src/ipc/libmultiprocess/src/mp/util.cpp:257 (head).
Details and suggested fix
fds is a plain integer array when the new error_fds allocation runs. If that allocation throws with EMFILE or ENFILE, for example with only two or three descriptor slots available, unwinding closes neither endpoint. All explicit cleanup starts at fork(), and ProcessImpl::spawn never receives the leaked descriptors. Base allocated only one pair, so this particular failure path is new; pre-fork callback or argument-allocation exceptions also now leak four descriptors instead of two. Give each endpoint scoped ownership immediately after creation, including inside SocketPair(), and release ownership only at the required handoff. Keep destruction out of the post-fork child, which already execs or calls _exit. The only current Core caller is hidden echoipc, and production impact under descriptor pressure is unconfirmed.
[minor] · Malformed -ipcchild values pass descriptor parsing
Bundled v14 accepts numeric prefixes such as "3abc" as descriptors instead of reporting the previous Invalid -ipcchild value error.
Location: src/ipc/libmultiprocess/src/mp/util.cpp:345 (head).
Details and suggested fix
Raising MP_MAJOR_VERSION to 14 disables Core's ToIntegral compatibility shim. checkSpawned() now calls upstream StartSpawned(), whose std::stoi accepts trailing characters, leading whitespace and a leading +. Thus "3abc" selects descriptor 3 and "0x10" selects descriptor 0. That result proceeds to the stream wrapper with TAKE_OWNERSHIP rather than being rejected by the parser. Out-of-range integers still throw. Restore full-string validation with std::from_chars, checking both its error and end pointer, and add a numeric-prefix case to check_spawned_test, which currently tests only a wholly non-numeric value. The parent generates decimal descriptor strings, and no current producer of malformed values was found, so production impact is unconfirmed.
[minor] · Non-owning ConnectStream leaks its connection when construct() throws
A throwing construct() with destroy_connection=false leaves an unreachable Connection and its event-loop reference, preventing normal loop shutdown.
Location: src/ipc/libmultiprocess/include/mp/proxy-io.h:879 (head).
Details and suggested fix
ConnectStream() unconditionally calls connection.release() before constructing the proxy. If construct() throws in non-owning mode, CleanupRun() removes the proxy's resources but deletes the connection only when destroy_connection is true. The disconnect deleter has the same condition and is installed only after successful construction. No client returns through which the caller could recover the connection, so its stream and EventLoopRef leak and joining the loop thread can hang. Retain temporary ownership in non-owning mode until construction succeeds, and destroy the connection on the event-loop thread on failure. Extend the disconnected-FooInit test to cover false mode and shutdown. No current caller combines false mode with an interface declaring construct(); Core uses the default owning mode, so production impact is unconfirmed.
[minor] · The race regression test can finish its RPC before disconnecting
The new TSan regression test can fail on correct code if the main thread is delayed beyond the worker's fixed 200 ms sleep.
Location: src/ipc/libmultiprocess/test/mp/test/test.cpp:441 (head).
Details and suggested fix
The method signals fn_called before results serialization, then the build hook sleeps for 200 ms. The main thread only initiates client_disconnect() after waking from that signal. If it is descheduled long enough, the worker finishes serialization and the shared event loop delivers a successful response before disconnection. EXPECT_EXCEPTION then fails, and that run misses the intended overlap. Replace the fixed delay with bounded coordination that holds the worker until disconnect processing has occurred without creating a happens-before edge between the relevant accesses. A relaxed-atomic flag set by the disconnected hook is one option; retain a deadline and verify that the getResults()/disconnect accesses remain unordered for TSan.
[minor] · Local dependency jobs reuse the first Cap'n Proto checkout
Successive local olddeps and newdeps runs share capnp/, so later runs can ignore the requested dependency revision even with CI_CLEAN=1.
Location: src/ipc/libmultiprocess/ci/scripts/ci.sh:28 (head).
Details and suggested fix
CAPNP_CHECKOUT selects a revision only when capnp/ does not exist. Both jobs then reuse capnp/build and install into the same capnp-install prefix without checking out or verifying the requested revision. Consequently, running olddeps first makes newdeps reuse v0.9.2 rather than master; reversing the order also defeats the requested minimum-version selection. The shared CMake cache retains the first compiler selection as well. The documented CI_CLEAN=1 does not repair this because it removes only the configuration-specific CI_DIR. Put the dependency source, build and install directories under CI_DIR so configuration changes and cleanup isolate them. Fresh, isolated GitHub Actions matrix jobs are unaffected.
Optional improvements
[suggestion] · Broad C++23 suppression also applies when the narrow flag works
Clang builds supporting the narrow lambda warning still receive the broad C++23 suppression, disabling unrelated extension diagnostics on targets using warn_interface.
Location: CMakeLists.txt:527 (head).
Details and suggested fix
The two try_append_cxx_flags() calls are independent. Whenever both probes succeed, the helper appends both -Wno-c++23-lambda-attributes and -Wno-c++23-extensions. The latter suppresses unrelated C++23 extension diagnostics, such as if consteval, rather than just accommodating the libmultiprocess lambda in C++20 mode. This propagates through core_interface, and the probes also apply to clang-cl because they sit outside the MSVC branch. Do not add the broad suppression when the narrow one is available. Capture the narrow probe with RESULT_VAR and run the broad fallback probe only when that result is false. This preserves the intended lambda exemption while retaining other extension diagnostics.
[suggestion] · Container adapters never select BuildList's rvalue branch
The current adapters always pass lvalues, and unique_ptr serialization still calls release(), so the new branch does not provide the comment's lvalue ownership guarantee.
Location: src/ipc/libmultiprocess/include/mp/proxy-types.h:307 (head).
Details and suggested fix
The vector, set, unordered-set and map adapters all pass their named value parameter without forwarding it. Consequently, even an rvalue container reaches BuildList() as an lvalue and selects the *it arm. Passing elements as lvalues also does not prevent consumption: the interface serializer calls unique_ptr::release() regardless of value category, and the new listBars test relies on that transfer. Simplify the current path to unconditional BuildField(..., *it) and document that unique_ptr interface elements transfer ownership even from lvalues. This preserves non-const iteration and vector<bool> proxy value categories. If rvalue-container moves are intended as supported behavior, forward through the adapters and add coverage for that branch instead.
[suggestion] · The deadlock test's watchdog starts after the blocking spawn
A callback-in-child regression can now block inside SpawnProcess before the test reaches its 30-second watchdog and kill-and-reap recovery.
Location: src/ipc/libmultiprocess/test/mp/test/spawn_tests.cpp:98 (head).
Details and suggested fix
If the callback regresses into a child forked while target_mutex is held, that child blocks on its inherited mutex. The releaser unlocks only the parent's copy. Unlike base, SpawnProcess() now waits for the child to exec or report an error, so it cannot return while the deadlocked child holds error_fds[0]. WaitPidWithTimeout() and its cleanup run only after that return, and the registered test has no test-specific timeout. Supervise the entire scenario in a helper process with a deadline covering the spawn call itself. On timeout, kill the helper's process group and reap the helper, while retaining the mutex-held-at-fork setup.
[suggestion] · The no-call disconnect test checks logging, not connection deletion
Removing disconnect-time deletion would still satisfy the warning assertion because the proxy's scope-exit cleanup would delete the connection later.
Location: src/ipc/libmultiprocess/test/mp/test/connect_tests.cpp:154 (head).
Details and suggested fix
The disconnect callback logs "unexpected network disconnect" before delete connection, but the test waits only for that log. Its default owning proxy can still delete the connection when foo goes out of scope, so fixture shutdown does not distinguish prompt disconnect cleanup from delayed cleanup. After observing the warning, release the test mutex and call setup.m_loop->sync([&] { KJ_EXPECT(!foo->m_context.connection); }); while foo is alive. Synchronizing with the loop lets the callback finish, and the null pointer confirms that ~Connection ran the synchronous cleanup callback. This adds a distinguishing assertion without a sleep.
[suggestion] · The exec-failure test leaves child reaping unasserted
Removing KillAndReapChild would leave the new test's exception assertions unchanged even though the failed child could remain unreaped.
Location: src/ipc/libmultiprocess/test/mp/test/spawn_tests.cpp:122 (head).
Details and suggested fix
The test checks only that spawning the nonexistent executable throws ENOENT and mentions execvp. The error path can throw that same exception without waiting for the child, so those assertions do not protect the new reaping behavior. Since failure returns no PID, run this case in an isolated helper process, or a process state known to have no other children, and assert after catching the exception that waitpid(-1, nullptr, WNOHANG) returns -1 with ECHILD. That checks completed reaping without accidentally waiting for an unrelated harness child.
[suggestion] · The new time_point serializer has no round-trip coverage
The standalone serialization fixture never instantiates the new time_point overloads, leaving signed tick counts and wire units unchecked.
Location: src/ipc/libmultiprocess/include/mp/type-chrono.h:38 (head).
Details and suggested fix
The adapter writes time_since_epoch().count() and reconstructs the value with Duration{input.get()}. The standalone fixture neither includes type-chrono.h nor has a time_point field or method, so its tests cannot detect a default-epoch result, truncation or a tick-unit mismatch. Add a millisecond time_point case backed by an Int64 field. Round-trip a negative non-whole-second value such as -123 ticks and a value beyond 32-bit range. Also assert one raw wire value so matching unit errors in the writer and reader cannot cancel out.
[suggestion] · The fixed-array size guard has no boundary coverage
No test exercises the new Data-length check that prevents partial updates or overruns of an unsigned char[N] destination.
Location: src/ipc/libmultiprocess/include/mp/type-char.h:34 (head).
Details and suggested fix
Base copied exactly size bytes without validating the input length. The new reader first rejects a mismatch, then copies the entire input range, making the guard essential to both short-input and oversized-input behavior. Neither the standalone fixture nor Core includes this adapter, so removing the guard would not fail an existing test. Add a direct adapter test with a four-byte destination filled with sentinel bytes. Assert that three- and five-byte inputs throw std::range_error without changing the destination, and that a four-byte input copies exactly.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [suggestion]: The listener test does not ensure disconnect precedes accept (earlier report)
- [suggestion]: Unexpected shutdownWrite errors bypass mandatory connection cleanup (earlier report)