Skip to content

Pin cpp_toolbelt and add a trigger_mechanism build setting - #160

Merged
dallison merged 5 commits into
pin-coroutines-poll-maskfrom
pin-cpp-toolbelt-socketpair
Nov 16, 2026
Merged

dallison merged 5 commits into
pin-coroutines-poll-maskfrom
pin-cpp-toolbelt-socketpair

Conversation

@dallison

@dallison dallison commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Pin coroutines to c2cbd0f75b1e834090762d584b812a485b8b8ca8 (dallison/co#77, merged, plus the TSan stack-switch fix). The poll fallback resumes a waiter only for the events it asked for. c2cbd0f also stops TSan from corrupting the shadow stack on a coroutine stack switch with GCC 15.
  • Pin cpp_toolbelt to a5b1cb994ec301db6023e98cfda71a7262d66bf9. It only changes cpp_toolbelt's own build files, so there are no toolbelt source changes here.
  • cpp_toolbelt eaa23f0 (the trigger-mechanism setting) is now a5b1cb9. dallison/cpp_toolbelt#32 is the matching toolbelt PR.
  • --//:trigger_mechanism=eventfd|pipe|socketpair overrides the platform default. default keeps the platform choice. CMake uses -DSUBSPACE_TRIGGER_MECHANISM=. See docs/trigger-mechanism.md.

Test plan

  • bazelisk test //... --config=macos_arm64 passes, 36/36 targets, with c2cbd0f and a5b1cb9.
  • //co20_rpc/... passes, including the three tests that timed out at 300s before the poll fix.
  • The fetched coroutines source contains the TSan macros from c2cbd0f.
  • --//:trigger_mechanism=socketpair and pipe put the trigger define on the toolbelt compile. default does not.
  • CI, including the Ubuntu TSan job (not run locally).
  • QNX build.

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.
@dallison dallison changed the title Pin cpp_toolbelt to the socketpair TriggerFd Pin cpp_toolbelt to the QNX socketpair TriggerFd Nov 15, 2026
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.
@dallison dallison changed the title Pin cpp_toolbelt to the QNX socketpair TriggerFd Pin cpp_toolbelt and add a trigger_mechanism build setting Nov 15, 2026
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
dallison merged commit 0e52858 into pin-coroutines-poll-mask Nov 16, 2026
52 checks passed
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant