Public bug reported:

1) The release of Ubuntu you are using:
Ubuntu 26.04.1 LTS (resolute), amd64 and arm64

2) The version of the package you are using:
libboost1.90-dev / libboost-context1.90-dev 1.90.0-6ubuntu1, g++ 
15.2.0-16ubuntu1

3) What you expected to happen:
An exception caught inside a boost::asio::spawn coroutine should stay the 
current exception, so `throw;` rethrows it.

4) What happened instead:
When coroutines move between threads, the exception state of another thread 
gets overwritten. `throw;` inside a catch block then aborts with "terminate 
called without an active exception":

g++ -O2 -std=c++17 -pthread -o repro repro.cpp -lboost_context
./repro rethrow 10    # aborts within milliseconds; with the patch it runs 10 s 
and exits 0

This is https://github.com/boostorg/context/issues/323.
`manage_exception_state` in boost/context/fiber_fcontext.hpp lost its
`BOOST_NOINLINE`, so gcc caches the TLS address from
`__cxa_get_globals()` across the fiber switch. It is fixed upstream in
Boost 1.92 by commit 0921b9fd5c
(https://github.com/boostorg/context/pull/331). The patch is attached;
it applies unchanged to 1.90.0-6ubuntu1.

We hit this with Icinga 2 (from packages.icinga.com) on 26.04: about 1
in 240 cancelled connections crashed an I/O thread. After rebuilding the
same sources against the patched header, we saw 0 in 12,675.
radosgw/librgw2 from ceph show the same code pattern. Since the bug is
in a header, affected packages need a rebuild after the fix.

** Affects: boost1.90 (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "repro.cpp"
   https://bugs.launchpad.net/bugs/2173538/+attachment/6015425/+files/repro.cpp

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2173538

Title:
  boost1.90: fibers clobber the libstdc++ exception state of another
  thread (upstream boostorg/context#323)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/boost1.90/+bug/2173538/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to