Bump Boost shipped for Windows to v1.87#10278
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
|
@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. |
|
... which is pretty annoying, seems that it works only with fibers now: boostorg/asio@df973a8#diff-4f46281483e5218aa919801a401dcd5b4c19704daa16f036e52da35a2860109dL1320 Definitely nothing for v2.14.4! |
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. |
Exactly. A bridge technology. I mean, aren't you happy that I'm
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.
Sure. A long-term solution. |
|
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". |
0fb35e6 to
31e2cce
Compare
Note
|
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:
Note on the test failureUnmodified(WHERE master = 1065d3b)
This just says us the Timeout callback, 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 |
| boost::asio::detached | ||
| #else // BOOST_VERSION >= 108700 | ||
| boost::coroutines::attributes(GetCoroutineStackSize()) // Set a pre-defined stack size. | ||
| #endif // BOOST_VERSION >= 108700 |
There was a problem hiding this comment.
For the record, this affects only Windows, currently. (Remember! WE control what we ship there.)
lib/base/io-engine.hpp
Outdated
| boost::asio::detached | ||
| #else // BOOST_VERSION >= 108000 | ||
| boost::coroutines::attributes(GetCoroutineStackSize()) // Set a pre-defined stack size. | ||
| #endif // BOOST_VERSION >= 108000 |
There was a problem hiding this comment.
This also affects:
- Fedora 39+ (all)
- Ubuntu 24.04+
There was a problem hiding this comment.
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?
It was removed in Boost 1.87.
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.
|
I've added two commits with some small changes:
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 |
|
|
||
| #if BOOST_VERSION >= 108700 | ||
| boost::asio::spawn(h, | ||
| std::allocator_arg, boost::context::fixedsize_stack(GetCoroutineStackSize()), |
There was a problem hiding this comment.
| 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>
|
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. |
|
Backport failed for 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 |
|
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. |
fixes #10347