5 minor findings · 8 suggestions
Findings
[minor] · Non-atomic close-on-exec can block the spawn handshake
An unrelated fork can inherit the new error-report endpoint before FD_CLOEXEC is set, leaving SpawnProcess waiting for EOF even after its own child successfully execs.
Location: src/ipc/libmultiprocess/src/mp/util.cpp:355 (head).
Details and suggested fix
SocketPair creates inheritable descriptors and sets FD_CLOEXEC afterward. If another thread forks before the flag is set on error_fds[0], a launcher that preserves unrelated descriptors can retain that endpoint across exec. ReadSpawnResult then remains blocked until the last inherited copy closes. The intended child's descriptor sweep does not affect that other process, and setting the flag later in the parent does not update its inherited copy. The base already had an IPC-descriptor leak, but this synchronous error-channel dependency is new. In Core, the only current caller is the hidden echoipc RPC, so triggering this requires a trusted call to overlap an operator-configured notify or external-signer launch; no production occurrence is established. Create the pairs with SOCK_CLOEXEC where supported, retaining and documenting the non-atomic fcntl fallback only on platforms such as macOS that need it.
[minor] · Second socket-pair allocation failure leaks the first pair
If allocating the new error-report pair throws, SpawnProcess leaks both descriptors from the first pair because cleanup starts only after fork.
Location: src/ipc/libmultiprocess/src/mp/util.cpp:257 (head).
Details and suggested fix
Both pairs are stored as raw integer arrays. If the second SocketPair fails with EMFILE or ENFILE, unwinding does not close the first pair, and ProcessImpl::spawn never receives those descriptors. For EMFILE, this is reachable when the process has room for the first pair but not the second. Argument-construction exceptions also now expose four descriptors instead of the base's two. The only current Core entry point is the hidden echoipc RPC, and production impact is unconfirmed. Use owning descriptor guards immediately after acquisition, including inside SocketPair, and retain ownership through the pre-fork work until explicit transfer or closure. This can preserve the existing async-signal-safe child path, which execs or calls _exit without running destructors.
[minor] · The v14 -ipcchild parser accepts malformed descriptor strings
Replacing the strict compat parser with unchecked std::stoi lets malformed local -ipcchild values select a descriptor instead of being rejected.
Location: src/ipc/libmultiprocess/src/mp/util.cpp:345 (head).
Details and suggested fix
The version bump disables Core's ToIntegral-based StartSpawned shim. The upstream replacement accepts numeric prefixes: "3abc", " 3", and "+3" become 3, while "0x10" becomes 0. checkSpawned then passes that descriptor into the serving path, which attempts to wrap it with TAKE_OWNERSHIP rather than reporting the existing invalid-argument error. The current test covers only the wholly nonnumeric value "invalid". The parent emits std::to_string(fd), and no current producer of malformed values was found, so production impact is unconfirmed. Use std::from_chars with both an error check and an end-pointer check to preserve full-string validation, and add a numeric-prefix rejection case.
[minor] · The disconnect regression test relies on a 200 ms scheduling window
If the main thread runs late, callMessageAsync can succeed before the disconnect, causing the new regression test to fail despite correct implementation behavior.
Location: src/ipc/libmultiprocess/test/mp/test/test.cpp:454 (head).
Details and suggested fix
The method signals fn_called before results serialization, and the results hook delays the worker for only 200 ms. Nothing ensures the main thread reaches client_disconnect within that interval. If it is descheduled long enough, the worker can finish and the event loop can deliver a successful response, failing EXPECT_EXCEPTION and missing the intended overlap. Keep the worker in the hook until disconnect processing has occurred, for example with a bounded wait on a relaxed atomic set by server_on_disconnect. Preserve the test's essential property that this coordination does not create a happens-before edge between the accesses whose race TSan must detect.
[minor] · Local dependency jobs reuse the first Cap'n Proto checkout
Switching between olddeps and newdeps in one worktree reuses the existing dependency checkout and compiler cache instead of honoring the requested configuration.
Location: src/ipc/libmultiprocess/ci/scripts/ci.sh:28 (head).
Details and suggested fix
Once capnp exists, ci.sh neither checks out nor verifies CAPNP_CHECKOUT. Both configurations also share capnp/build and capnp-install outside CI_DIR. Consequently, the documented local olddeps/newdeps sequence reuses whichever revision was cloned first, and CMake retains the first compiler selection. CI_CLEAN does not repair this because it removes only CI_DIR. This can make a successful job test the wrong dependency version; isolated GitHub Actions jobs avoid the trigger. Put the dependency source, build, and install directories under the configuration-specific CI_DIR so the configurations remain separate and CI_CLEAN removes their dependency state.
Optional improvements
[suggestion] · The broad fallback suppresses unrelated C++23-extension warnings
Clang versions accepting both flags receive the broad suppression across core_interface, although the narrow lambda-attribute suppression is sufficient.
Location: CMakeLists.txt:523 (head).
Details and suggested fix
The two probes run independently, so accepting the narrow option does not prevent adding -Wno-c++23-extensions. That broader option disables diagnostics for unrelated C++23 extensions in C++20 builds, such as if consteval, on targets using core_interface rather than only the IPC lambda. Use RESULT_VAR on the narrow probe and try the broad suppression only when the narrow flag is unavailable. This retains the stated older-Clang workaround without unnecessarily reducing diagnostic coverage on compilers that support the specific warning group.
[suggestion] · Container adapters leave BuildList's rvalue branch unused
All current adapters take the lvalue branch, which still transfers unique_ptr ownership despite the comment promising that lvalue elements are not moved from.
Location: src/ipc/libmultiprocess/include/mp/proxy-types.h:307 (head).
Details and suggested fix
The vector, set, unordered_set, and map adapters pass their named value parameter as an lvalue, even when they received an rvalue. No tracked caller supplies an rvalue container directly to BuildList, so the std::move(*it) arm is unused by current paths. Moreover, passing *it as an lvalue does not prevent consumption: the unique_ptr interface serializer calls release(), and listBars relies on that transfer. For the current adapter paths, remove the conditional and pass *it directly. This preserves vector<bool> proxy value categories and existing interface ownership transfer. Document that transfer explicitly rather than promising that caller-owned lvalue elements remain intact.
[suggestion] · The deadlock-test watchdog starts after the blocking spawn
A callback-in-child regression can block inside SpawnProcess, preventing the test from reaching its 30-second wait or child cleanup.
Location: src/ipc/libmultiprocess/test/mp/test/spawn_tests.cpp:98 (head).
Details and suggested fix
If the callback runs in a child forked while target_mutex is held, the child cannot acquire its copied mutex even after the parent releases its own copy. SpawnProcess now waits for that child to exec or report an error, so it never returns in this regression schedule. WaitPidWithTimeout and the kill/reap recovery are both too late to supervise it. Run the entire scenario in an isolated helper process under an external deadline, preserving the mutex-held-at-fork setup. On timeout, kill the helper's process group and reap the helper so the test reports a bounded failure instead of hanging before its watchdog.
[suggestion] · The listener test does not ensure disconnect precedes accept
An ordinary accept-then-disconnect satisfies the new test, so a successful run does not establish coverage of an already-closed peer.
Location: src/ipc/libmultiprocess/test/mp/test/listen_tests.cpp:245 (head).
Details and suggested fix
The server loop is already running when the test connects and closes the client socket. It can accept between those two operations, and DisconnectedCount() == 1 passes in that ordinary schedule. Run MakeConnectedSocket and close inside a (**server.m_loop_ref).sync callback so the server cannot process accept between them. Keep the existing macOS allowance for an accept error and the normal disconnect-count expectation elsewhere.
[suggestion] · The disconnect test observes logging rather than connection deletion
The no-client-calls test would still pass if the disconnect callback stopped deleting the connection, because it checks only the preceding warning.
Location: src/ipc/libmultiprocess/test/mp/test/connect_tests.cpp:154 (head).
Details and suggested fix
The callback logs the warning before delete connection. If that deletion were removed, destroying foo would still delete its owned connection through the proxy cleanup path, so fixture teardown would not expose the missing eager cleanup. After observing the warning, call setup.m_loop->sync with an assertion that foo->m_context.connection is null while foo remains alive. This waits for the disconnect callback to finish and checks the claimed deletion without adding a sleep.
[suggestion] · The exec-failure test leaves child reaping unasserted
Removing KillAndReapChild would leave the new exec-failure assertions passing while the failed child remains unreaped.
Location: src/ipc/libmultiprocess/test/mp/test/spawn_tests.cpp:122 (head).
Details and suggested fix
The test asserts ENOENT and the execvp diagnostic, but the production path throws the same exception independently of its reaping call. Since SpawnProcess does not return the pid on failure, run this case in an isolated forked helper and, after catching the exception, require waitpid(-1, nullptr, WNOHANG) to fail with ECHILD. Isolation prevents unrelated harness children from affecting the assertion.
[suggestion] · The time_point adapters lack a standalone round-trip test
The standalone test fixture does not instantiate the new time_point overloads, leaving their epoch tick-count behavior without regression assertions.
Location: src/ipc/libmultiprocess/include/mp/type-chrono.h:38 (head).
Details and suggested fix
The new build overload writes time_since_epoch().count(), and the read overload reconstructs the point from Duration{input.get()}. The Foo fixture does not include type-chrono.h or provide a time_point case, so its assertions cannot detect default-valued results, subsecond truncation, or incorrect tick units. Add a fixture field or method using a millisecond time_point with an Int64 wire field. Round-trip a negative non-whole-second value such as -123 ticks and a value beyond the 32-bit range.
[suggestion] · The fixed-array length check lacks regression coverage
No adapter test protects rejection of mismatched Data lengths before an unsigned char[N] destination is modified.
Location: src/ipc/libmultiprocess/include/mp/type-char.h:34 (head).
Details and suggested fix
The new guard throws before read_dest.update, then the copy consumes the full input range. Removing that guard would allow a short input to partially update the destination and an oversized input to overrun it without affecting the current fixture, which does not include type-char.h. No current Core include of this adapter was found. Add a direct test with a four-byte destination initialized to sentinel bytes. Require three- and five-byte inputs to throw without changing it, and verify that a four-byte input copies exactly.