lms: fix crash on startup due to boost::asio ABI mismatch - #62009
Open
Danoloan10 wants to merge 1 commit into
Open
lms: fix crash on startup due to boost::asio ABI mismatch#62009Danoloan10 wants to merge 1 commit into
Danoloan10 wants to merge 1 commit into
Conversation
lms and libwthttp (from wt) each compile their own copy of the header-only boost::asio, but share one epoll_reactor at runtime via asio's service registry. Their reactor layouts must therefore match. asio's reactor layout depends on BOOST_ASIO_HAS_STD_ATOMIC_WAIT (C++20 std::atomic::wait): lms is C++20, so asio uses atomic_slim_mutex (152-byte reactor, free_list_ at +0x90); wt is C++14, so libwthttp uses posix_mutex (232-byte reactor, free_list_ at +0xe0). The mismatch makes libwthttp read registered_descriptors_ past lms's allocation and SIGSEGV in object_pool::alloc during Server::start (addTcpListener) on every startup. Force the posix_mutex path with BOOST_ASIO_DISABLE_STD_ATOMIC_WAIT so lms's reactor ABI matches libwthttp. Verified on x86_64-musl: lms now starts and serves on :5082 without crashing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
lms would crash in x86_64-musl after updating every package to their latest versions.
lms and libwthttp (from wt) each compile their own copy of the header-only boost::asio, but share one epoll_reactor at runtime via asio's service registry. Their reactor layouts must therefore match.
asio's reactor layout depends on BOOST_ASIO_HAS_STD_ATOMIC_WAIT (C++20 std::atomic::wait): lms is C++20, so asio uses atomic_slim_mutex (152-byte reactor, free_list_ at +0x90); wt is C++14, so libwthttp uses posix_mutex (232-byte reactor, free_list_ at +0xe0).
The mismatch makes libwthttp read registered_descriptors_ past lms's allocation and SIGSEGV in object_pool::alloc during Server::start (addTcpListener) on every startup.
Force the posix_mutex path with BOOST_ASIO_DISABLE_STD_ATOMIC_WAIT so lms's reactor ABI matches libwthttp. Verified on x86_64-musl: lms now starts and serves on :5082 without crashing.
Testing the changes
Local build testing