Skip to content

Fix Boost.Context corrupting the exception state on coroutine resume - #11168

Draft
jschmidt-icinga wants to merge 2 commits into
masterfrom
coroutine-exception-corruption
Draft

jschmidt-icinga wants to merge 2 commits into
masterfrom
coroutine-exception-corruption

Conversation

@jschmidt-icinga

@jschmidt-icinga jschmidt-icinga commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

This adds a workaround for boostorg/context#323 which manifests on boost versions 1.88 through 1.91. The workaround redefines __cxa_get_globals while the Boost.Fiber header is being included to a custom wrapper function that cannot be inlined or have its result cached.

Affected distro releases:

  • Fedora 44
  • Fedora 45
  • Ubuntu 26.04
  • Ubuntu 26.10

Test case

I added a test case that acts as both diagnostic tool to see which distros are affected as well as verification for the fix. See here for a negative test run without the fix (if the Ubuntu repo gods are merciful today).

The test case also functions as easy to follow documentation for how the bug manifests.

Alternatives

This is obviously quite ugly, but there are no good alternatives. Alternatives considered:

  • Ship custom boost packages that contain the fix for the affected distros: Would need to be decided by someone else and take much longer to implement than this.
  • Waiting for distros to patch their boost: The reporter has already opened an issue for Ubuntu, but someone (not me) would need to report and track progress for Fedora.
  • Patching just the header from system includes in CMake and putting it in a later include directory or force-including it like the header from this fix: About as ugly as this one, but could make problems if distros decide to patch their boost after all.
  • Building with global -fno-inline: Would solve the issue, but cost a lot of performance and be less reliable, because we can only control it for our own packages and even then it would need to be carefully tested in combination with other optimization flags.

Fixes #11160.

@cla-bot cla-bot Bot added the cla/signed label Nov 11, 2026
@jschmidt-icinga jschmidt-icinga changed the title Fix Boost.Context corrupting the exception Fix Boost.Context corrupting the exception state on coroutine resume Nov 11, 2026
@jschmidt-icinga jschmidt-icinga added consider backporting Should be considered for inclusion in a bugfix release bug Something isn't working labels Nov 11, 2026
@jschmidt-icinga jschmidt-icinga added this to the 2.17.0 milestone Nov 11, 2026
@jschmidt-icinga
jschmidt-icinga force-pushed the coroutine-exception-corruption branch 2 times, most recently from 2a669eb to 8b83266 Compare November 12, 2026 09:20
@jschmidt-icinga
jschmidt-icinga force-pushed the coroutine-exception-corruption branch from 8b83266 to e5f91e2 Compare November 12, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cla/signed consider backporting Should be considered for inclusion in a bugfix release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ubuntu 26.04 packages: I/O threads get stuck in ExceptionHandler after std::terminate (Boost.Context 1.90 bug)

1 participant