Repository navigation
Pin cpp_toolbelt and add a trigger_mechanism build setting - #160
Merged
Merged
Conversation
On non-Linux POSIX, TriggerFd used a pipe. The qnx_pipes branch uses a Unix domain socketpair instead, which is what QNX and macOS need for the same poll behavior as eventfd.
macOS keeps the pipe. A socketpair was slower there when a publish wakes another thread, and QNX is the platform whose pipe service needs the socketpair.
The platform default stays eventfd on Linux, a socketpair on QNX, and a pipe elsewhere. --//:trigger_mechanism and SUBSPACE_TRIGGER_MECHANISM select eventfd, pipe, or socketpair when a build needs a different way to wake a waiting subscriber.
The new cpp_toolbelt commit only changes its own MODULE.bazel and adds third_party/coroutines_tsan.patch for GCC 15 TSan stack switches. No toolbelt sources change, so Subspace picks it up without a behavior change.
c2cbd0f keeps TSan from corrupting the shadow stack when a coroutine switches stacks on GCC 15, on top of the poll event-mask fix (dallison/co#77). Verified on macOS arm64 with bazelisk test //... (36 targets).
dallison
added a commit
that referenced
this pull request
Nov 16, 2026
* Pin coroutines to the cpp20 poll-mask fix. The poll fallback resumed every waiter on an fd for POLLIN or POLLOUT. A socketpair is always writable, so a POLLIN waiter spun and co20_rpc hung on macOS. co#77 records each waiter's mask and resumes only a match. * Pin cpp_toolbelt and add a trigger_mechanism build setting (#160) * Pin cpp_toolbelt to the socketpair TriggerFd. On non-Linux POSIX, TriggerFd used a pipe. The qnx_pipes branch uses a Unix domain socketpair instead, which is what QNX and macOS need for the same poll behavior as eventfd. * Pin the QNX-only socketpair TriggerFd. macOS keeps the pipe. A socketpair was slower there when a publish wakes another thread, and QNX is the platform whose pipe service needs the socketpair. * Let builds choose the trigger mechanism. The platform default stays eventfd on Linux, a socketpair on QNX, and a pipe elsewhere. --//:trigger_mechanism and SUBSPACE_TRIGGER_MECHANISM select eventfd, pipe, or socketpair when a build needs a different way to wake a waiting subscriber. * Pin cpp_toolbelt to a5b1cb9 (TSan patch for coroutines). The new cpp_toolbelt commit only changes its own MODULE.bazel and adds third_party/coroutines_tsan.patch for GCC 15 TSan stack switches. No toolbelt sources change, so Subspace picks it up without a behavior change. * Pin coroutines to c2cbd0f (TSan stack-switch fix). c2cbd0f keeps TSan from corrupting the shadow stack when a coroutine switches stacks on GCC 15, on top of the poll event-mask fix (dallison/co#77). Verified on macOS arm64 with bazelisk test //... (36 targets).
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.
Summary
coroutinestoc2cbd0f75b1e834090762d584b812a485b8b8ca8(dallison/co#77, merged, plus the TSan stack-switch fix). The poll fallback resumes a waiter only for the events it asked for.c2cbd0falso stops TSan from corrupting the shadow stack on a coroutine stack switch with GCC 15.cpp_toolbelttoa5b1cb994ec301db6023e98cfda71a7262d66bf9. It only changes cpp_toolbelt's own build files, so there are no toolbelt source changes here.cpp_toolbelteaa23f0(the trigger-mechanism setting) is nowa5b1cb9. dallison/cpp_toolbelt#32 is the matching toolbelt PR.--//:trigger_mechanism=eventfd|pipe|socketpairoverrides the platform default.defaultkeeps the platform choice. CMake uses-DSUBSPACE_TRIGGER_MECHANISM=. Seedocs/trigger-mechanism.md.Test plan
bazelisk test //... --config=macos_arm64passes, 36/36 targets, withc2cbd0fanda5b1cb9.//co20_rpc/...passes, including the three tests that timed out at 300s before the poll fix.coroutinessource contains the TSan macros fromc2cbd0f.--//:trigger_mechanism=socketpairandpipeput the trigger define on the toolbelt compile.defaultdoes not.