Skip to content

Bump Boost shipped for Windows to v1.87#10278

Merged
julianbrost merged 8 commits intomasterfrom
boost187
Apr 15, 2025
Merged

Bump Boost shipped for Windows to v1.87#10278
julianbrost merged 8 commits intomasterfrom
boost187

Conversation

@Al2Klimov
Copy link
Member

@Al2Klimov Al2Klimov commented Jan 2, 2025

fixes #10347

@Al2Klimov Al2Klimov added area/windows Windows agent and plugins area/ci CI/CD labels Jan 2, 2025
@Al2Klimov Al2Klimov added this to the 2.15.0 milestone Jan 2, 2025
@cla-bot cla-bot bot added the cla/signed label Jan 2, 2025
@Al2Klimov

This comment was marked as resolved.

@Al2Klimov Al2Klimov self-assigned this Jan 8, 2025
@Al2Klimov Al2Klimov marked this pull request as draft January 8, 2025 09:15
@Al2Klimov Al2Klimov added the consider backporting Should be considered for inclusion in a bugfix release label Jan 8, 2025
@Al2Klimov
Copy link
Member Author

@julianbrost @yhabteab @oxzi In your own interest, please pin Boost to < v1.87 for now.

boost::asio::spawn() doesn't take boost::coroutines::attributes anymore.

@Al2Klimov
Copy link
Member Author

... which is pretty annoying, seems that it works only with fibers now: boostorg/asio@df973a8#diff-4f46281483e5218aa919801a401dcd5b4c19704daa16f036e52da35a2860109dL1320

Definitely nothing for v2.14.4!

@julianbrost
Copy link
Member

@julianbrost @yhabteab @oxzi In your own interest, please pin Boost to < v1.87 for now.

That's only a very short-term solution. This will turn into a bigger problem as soon as any distro starts shipping that version. So this needs a proper solution in any case.

@Al2Klimov
Copy link
Member Author

That's only a very short-term solution.

Exactly. A bridge technology.

I mean, aren't you happy that I'm urging NOT urging yet another PR of mine into the current milestone?

This will turn into a bigger problem as soon as any distro starts shipping that version.

Yet, both Ubuntu 25 and Fedora 42 have Boost 1.83. OpenBSD 7.7 has v1.84 yet, on NixOS pinning is easiest of all I guess and MacOS isn't even officially supported.

So this needs a proper solution in any case.

Sure. A long-term solution.

@julianbrost
Copy link
Member

I don't say this must go into 2.14.4, I'm just saying that we shouldn't wait until "oh fuck, Fedora 44 is here and we can't build packages".

@Al2Klimov Al2Klimov force-pushed the boost187 branch 2 times, most recently from 0fb35e6 to 31e2cce Compare January 10, 2025 11:39
@Al2Klimov Al2Klimov marked this pull request as ready for review January 10, 2025 11:39
@Al2Klimov Al2Klimov removed their assignment Jan 10, 2025
@Al2Klimov Al2Klimov marked this pull request as draft January 10, 2025 14:11
@Al2Klimov
Copy link
Member Author

@Al2Klimov
Copy link
Member Author

we shouldn't wait until "oh fuck, Fedora 44 is here and we can't build packages".

A theoretical option is still doing the AL2-move, i.e building Icinga-boost 1.86 packages for that one or two $OS. (It's funny because normally that's been done due to Boost being too OLD, not too NEW.😅) Sound radical, but:

  1. can still be undone for any future Icinga version
  2. other OS have even older Boost versions
  3. Fedora has the shortest per-version support lifetime
  4. even the current PR state I'd rather not backport, if not necessary (or you insist), until a .0 and a .1 version of Icinga 2 with this PR

Note on the test failure

Unmodified

(WHERE master = 1065d3b)

.../icinga2/test/base-io-engine.cpp:38: error: in "base_io_engine/timeout_run": check called == 1 has failed [0 != 1]

This just says us the Timeout callback, [&called] { ++called; }, hasn't been called.

Has the coroutine even been started?

--- a/test/base-io-engine.cpp
+++ b/test/base-io-engine.cpp
@@ -20,2 +20,3 @@ BOOST_AUTO_TEST_CASE(timeout_run)
        boost::asio::spawn(strand, [&](boost::asio::yield_context yc) {
+               BOOST_CHECK_EQUAL(called, 1337);
                boost::asio::deadline_timer timer (io);

Now the test fails exactly like above, not with 1337, so the answer is no.

We need to go deeper...

--- a/test/base-io-engine.cpp
+++ b/test/base-io-engine.cpp
@@ -2,40 +2,46 @@

 #include "base/io-engine.hpp"
 #include "base/utility.hpp"
 #include <boost/asio.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
 #include <BoostTestTargetConfig.h>
+#include <memory>
 #include <thread>

 using namespace icinga;

 BOOST_AUTO_TEST_SUITE(base_io_engine)

 BOOST_AUTO_TEST_CASE(timeout_run)
 {
        boost::asio::io_context io;
        boost::asio::io_context::strand strand (io);
        int called = 0;
+       auto workGuard (std::make_unique<decltype(boost::asio::make_work_guard(io))>(boost::asio::make_work_guard(io)));

        boost::asio::spawn(strand, [&](boost::asio::yield_context yc) {
+               BOOST_CHECK_EQUAL(called, 1337);
                boost::asio::deadline_timer timer (io);

                Timeout timeout (strand, boost::posix_time::millisec(300), [&called] { ++called; });
                BOOST_CHECK_EQUAL(called, 0);

                timer.expires_from_now(boost::posix_time::millisec(200));
                timer.async_wait(yc);
                BOOST_CHECK_EQUAL(called, 0);

                timer.expires_from_now(boost::posix_time::millisec(200));
                timer.async_wait(yc);
+               workGuard = nullptr;
        });

        std::thread eventLoop ([&io] { io.run(); });
+       BOOST_CHECK_EQUAL(called, 23);
        io.run();
+       BOOST_CHECK_EQUAL(called, 42);
        eventLoop.join();

        BOOST_CHECK_EQUAL(called, 1);
 }

 BOOST_AUTO_TEST_CASE(timeout_cancelled)

This one was my previous printf-debugger and it hangs at 0 != 23. I.e run() awaits workGuard, but the coroutine never stops that.

@Al2Klimov Al2Klimov marked this pull request as ready for review January 10, 2025 15:41
boost::asio::detached
#else // BOOST_VERSION >= 108700
boost::coroutines::attributes(GetCoroutineStackSize()) // Set a pre-defined stack size.
#endif // BOOST_VERSION >= 108700
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record, this affects only Windows, currently. (Remember! WE control what we ship there.)

boost::asio::detached
#else // BOOST_VERSION >= 108000
boost::coroutines::attributes(GetCoroutineStackSize()) // Set a pre-defined stack size.
#endif // BOOST_VERSION >= 108000
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also affects:

  • Fedora 39+ (all)
  • Ubuntu 24.04+

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand what you are trying to say! The check from #10278 (review) was actually exactly how I expected it to be, but you just changed it without any explanation and posted this afterwards. Isn't this all about boost >= 1.87, so why change the implementation for all boost 1.80+ versions?

@Al2Klimov Al2Klimov removed the consider backporting Should be considered for inclusion in a bugfix release label Feb 3, 2025
@yhabteab yhabteab mentioned this pull request Feb 10, 2025
yhabteab
yhabteab previously approved these changes Mar 11, 2025
Copy link
Member

@yhabteab yhabteab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested Boost 1.85 and 1.87 and have found nothing suspicious so far, so LFTM!

@yhabteab yhabteab requested a review from julianbrost March 11, 2025 15:49
Al2Klimov and others added 7 commits April 14, 2025 17:30
not just boost::coroutines::detail::forced_unwind.

This is needed because as of Boost 1.87, boost::asio::spawn() uses Fiber, not Coroutine v1.
boostorg/asio@df973a85ed69f021

This is safe because every actual exception shall inherit from std::exception. Except forced_unwind and its Fiber equivalent, so that `catch(const std::exception&)` doesn't catch them and only them.
Creating the string_view from the std::string (as returned by GetData()) uses
the stored length instead of having to detect it by finding '\0'.
Simply giving two entire call expressions for either Boost version greatly
improves readability in my opinion.
@julianbrost
Copy link
Member

I've added two commits with some small changes:

  1. ccfc722 avoids the use of .CStr() and keeps the strings in the C++ string world.
  2. d1d399f avoids multiple #if case-distinctions within the same function call to make it a bit more readable.

Additionally, I've rebased the PR to get up-to-date action jobs. I've you rebase 62221b2 (state of this PR before I've force-pushed to it) onto 9cc3971 (current state of the master branch), you'll get a commit with the same contents as fb2b2e2 (commit boost187~2 in this PR, i.e. the last commit before my additional 2 commits).

@julianbrost julianbrost requested a review from yhabteab April 14, 2025 16:07

#if BOOST_VERSION >= 108700
boost::asio::spawn(h,
std::allocator_arg, boost::context::fixedsize_stack(GetCoroutineStackSize()),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::allocator_arg, boost::context::fixedsize_stack(GetCoroutineStackSize()),
std::allocator_arg,
boost::context::fixedsize_stack(GetCoroutineStackSize()),

f isn't used otherwise in the function, so if possible, it can just be moved into the lambda, avoiding a copy.

Co-authored-by: Alexander Aleksandrovič Klimov <alexander.klimov@icinga.com>
@julianbrost julianbrost enabled auto-merge April 15, 2025 13:54
@yhabteab
Copy link
Member

The GHAs seem to be in a broken state somehow, although there is not much going on in the Icinga 2 repo. So I guess you have to push an empty commit to reactivate them :), since GitHub doesn't seem to provide a re-run button for them.

@julianbrost julianbrost merged commit 520aed6 into master Apr 15, 2025
26 checks passed
@julianbrost julianbrost deleted the boost187 branch April 15, 2025 16:22
bob-beck pushed a commit to openbsd/ports that referenced this pull request Apr 24, 2025
@yhabteab yhabteab added the backport-to-support/2.14 PRs with this label will automatically be backported to the v2.14 support branch. label Nov 28, 2025
@backbot-ci
Copy link

backbot-ci bot commented Nov 28, 2025

Backport failed for support/2.14, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin support/2.14
git worktree add -d .worktree/backport-10278-to-support/2.14 origin/support/2.14
cd .worktree/backport-10278-to-support/2.14
git switch --create backport-10278-to-support/2.14
git cherry-pick -x 11ab8690164b76504facf6438e735c941283fbc3 7bd35d8c6b7658170835de0fa623e3a4099569fb 011c67964ee2ab4c9a21f8aab322663e3bf5c317 0662f2b7193693ba1129690ac004af7f866470bb fb2b2e2d5b32a02309aa1c50ae5e9fb873922988 ccfc72267f5c4bddad6779bb30c93a504f286500 d1d399f8b329dbe3f6f1f172ece165332fb9512f d3fae440d4b229581c39bc972ea2f3edf0d23efe

@yhabteab
Copy link
Member

Ok. it can't backport it but something is wrong with the action because in such cases I've configured it to nonetheless open a draft PR but that doesn't seem to work at all.

@yhabteab yhabteab removed the backport-to-support/2.14 PRs with this label will automatically be backported to the v2.14 support branch. label Nov 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ci CI/CD area/windows Windows agent and plugins cla/signed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support boost 1.87

3 participants