Open brad0 opened 3 years ago
I wonder if something changed in asio to pick up the custom allocator, but not the custom deallocator, which would make it try to free the custom storage for some handlers with the system free()
function.
Weird how I saw a post notification from GitHub for a post from Elias but it doesn't show in the issue.
Weird how I saw a post notification from GitHub for a post from Elias but it doesn't show in the issue.
Yeah... I deleted the message, I don't want to mislead given that I am not a C++ dev nor a boost developer. But I found this changes on Boost 1.77 that might be related to what @arvidn commented about the allocator:
https://www.boost.org/users/history/version_1_77_0.html
Added the associator trait, used to generically forward associators. Increased the number of cached slots in the default recycling allocator. Changed the default allocator behaviour to respect alignment requirements, to support over-aligned types.
There are several commits related also on the boost/asio github repository: https://github.com/boostorg/asio/search?o=desc&q=allocator&s=committer-date&type=commits https://github.com/boostorg/asio/search?o=desc&q=associator&s=committer-date&type=commits The commits for 1.77 are from 7 Apr to 4 Aug.
Maybe that links help you to find what difference is causing this. And the links about the associator trait are there just because I understand that is now used on the associated_allocator.
Yeah... I deleted the message, I don't want to mislead given that I am not a C++ dev nor a boost developer
Ah, that explains it. It's better to have more potentially useful information which could be discarded if not useful than none at all.
I wonder if something changed in asio to pick up the custom allocator, but not the custom deallocator, which would make it try to free the custom storage for some handlers with the system
free()
function.
Any comment on what Elias has posted?
I don't know how to trouble-shoot this. I don't build 1.2.x on BSD, only 2.0.x is built on cirrus. On windows, Linux and Mac, boost-1.77 has not caused any issues. It looks a bit like an ABI incompatibility/build issue.
You build all dependencies from source though, right? There's no risk of linking against an older boost binary but including a newer boost header, right?
If so, there's no risk boost is built with a different set of #define
s than libtorrent, is there?
There are indications that it crashes on linux too https://bugs.gentoo.org/815145
It doesn't crash on my PC, and I suspect it is only reproducible if built with clang, but not with gcc.
There are indications that it crashes on linux too https://bugs.gentoo.org/815145
It doesn't crash on my PC, and I suspect it is only reproducible if built with clang, but not with gcc.
Thanks. OpenBSD uses Clang as the system compiler nowadays. We'e just about to update from 11 to 13, but need to fix package build fallout from the new compiler release first.
neither clang-11 nor clang-10 reproduces this on Ubuntu for me. The Ubuntu clang-12 package doesn't seem to work (it produces broken binaries for me)
I'm not 100% if only libtorrent has to be built with clang or boost as well, and also the reporter in gentoo bugzilla mentioned they are using llvm-libcxx, so that might or might not be a factor too. But for sure, if they are using libcxx for libtorrent, all dependencies are using it too, because it's not ABI compatible with libstdc++ from gcc. Speaking of producing broken binaries, that might be why. As to versions, they are using at least clang-12, maybe 13.
My system don't have gcc installed and all packages are built use musl libc, libc++ and libc++abi and clang/clang++ as compiler from source code.
^ https://bugs.gentoo.org/815145#c6
So, I guess, it's the same or similar in OpenBSD. @arvidn that might be why you can't reproduce it on ubuntu.
clang 13 + libc++ 13 + musl
Starting up torrent "f0d6f1039ceedcdbf91df2d75203c6dcde150474" ...
Starting up torrent "d6ac13732068d4c5494229e79e5ff9ba657165ff" ...
=================================================================
==4357==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x606000396028 in thread T4
Starting up torrent "8db2e5f15490a06172daba71f4c288a436c793e2" ...
Starting up torrent "84f5c8b6c70d652b56ca149a926aa298d7aa0da7" ...
#0 0x562b748b9882 in free (/usr/bin/qbittorrent+0xa81882)
#1 0x7f698b749b99 in boost::alignment::aligned_free(void*) /usr/include/boost/align/detail/aligned_alloc_posix.hpp:35:5
#2 0x7f698b749b99 in boost::asio::aligned_delete(void*) /usr/include/boost/asio/detail/memory.hpp:124:3
#3 0x7f698b749b99 in void boost::asio::detail::thread_info_base::deallocate<boost::asio::detail::thread_info_base::default_tag>(boost::asio::detail::thread_info_base::default_tag, boost::asio::detail::thread_info_base*, void*, unsigned long) /usr/include/boost/asio/detail/thread_info_base.hpp:198:5
#4 0x7f698b749b99 in boost::asio::detail::recycling_allocator<boost::asio::detail::executor_op<boost::asio::detail::binder0<libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0>, std::__1::allocator<void>, boost::asio::detail::scheduler_operation>, boost::asio::detail::thread_info_base::default_tag>::deallocate(boost::asio::detail::executor_op<boost::asio::detail::binder0<libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0>, std::__1::allocator<void>, boost::asio::detail::scheduler_operation>*, unsigned long) /usr/include/boost/asio/detail/recycling_allocator.hpp:60:5
#5 0x7f698b749b99 in boost::asio::detail::executor_op<boost::asio::detail::binder0<libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0>, std::__1::allocator<void>, boost::asio::detail::scheduler_operation>::ptr::reset() /usr/include/boost/asio/detail/executor_op.hpp:35:3
#6 0x7f698b749b99 in boost::asio::detail::executor_op<boost::asio::detail::binder0<libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0>, std::__1::allocator<void>, boost::asio::detail::scheduler_operation>::do_complete(void*, boost::asio::detail::scheduler_operation*, boost::system::error_code const&, unsigned long) /usr/include/boost/asio/detail/executor_op.hpp:63:7
#7 0x7f698b29434c in boost::asio::detail::scheduler_operation::complete(void*, boost::system::error_code const&, unsigned long) /usr/include/boost/asio/detail/scheduler_operation.hpp:40:5
#8 0x7f698b29434c in boost::asio::detail::scheduler::do_run_one(boost::asio::detail::conditionally_enabled_mutex::scoped_lock&, boost::asio::detail::scheduler_thread_info&, boost::system::error_code const&) /usr/include/boost/asio/detail/impl/scheduler.ipp:486:12
#9 0x7f698b292ee3 in boost::asio::detail::scheduler::run(boost::system::error_code&) /usr/include/boost/asio/detail/impl/scheduler.ipp:204:10
#10 0x7f698b9f4ad3 in boost::asio::io_context::run() /usr/include/boost/asio/impl/io_context.ipp:63:24
#11 0x7f698b9f4ad3 in libtorrent::session::start(libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>, libtorrent::session_params&&, boost::asio::io_context*)::$_0::operator()() const /usr/src/debug/net-libs/libtorrent-rasterbar-2.0.4-r4/libtorrent-rasterbar-2.0.4/src/session.cpp:344:14
#12 0x7f698b9f4ad3 in decltype(static_cast<libtorrent::session::start(libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>, libtorrent::session_params&&, boost::asio::io_context*)::$_0>(fp)()) std::__1::__invoke<libtorrent::session::start(libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>, libtorrent::session_params&&, boost::asio::io_context*)::$_0>(libtorrent::session::start(libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>, libtorrent::session_params&&, boost::asio::io_context*)::$_0&&) /usr/include/c++/v1/type_traits:3918:1
#13 0x7f698b9f4ad3 in void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, libtorrent::session::start(libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>, libtorrent::session_params&&, boost::asio::io_context*)::$_0>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, libtorrent::session::start(libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>, libtorrent::session_params&&, boost::asio::io_context*)::$_0>&, std::__1::__tuple_indices<>) /usr/include/c++/v1/thread:280:5
#14 0x7f698b9f4ad3 in void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, libtorrent::session::start(libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>, libtorrent::session_params&&, boost::asio::io_context*)::$_0> >(void*) /usr/include/c++/v1/thread:291:5
0x606000396028 is located 8 bytes inside of 56-byte region [0x606000396020,0x606000396058)
allocated by thread T28 here:
#0 0x562b748b99dd in malloc (/usr/bin/qbittorrent+0xa819dd)
#1 0x7f698b2a53af in boost::alignment::aligned_alloc(unsigned long, unsigned long) /usr/include/boost/align/detail/aligned_alloc.hpp:31:15
#2 0x7f698b2a53af in boost::asio::aligned_new(unsigned long, unsigned long) /usr/include/boost/asio/detail/memory.hpp:97:15
#3 0x7f698b2a53af in void* boost::asio::detail::thread_info_base::allocate<boost::asio::detail::thread_info_base::default_tag>(boost::asio::detail::thread_info_base::default_tag, boost::asio::detail::thread_info_base*, unsigned long, unsigned long) /usr/include/boost/asio/detail/thread_info_base.hpp:170:27
#4 0x7f698b749124 in boost::asio::detail::recycling_allocator<boost::asio::detail::executor_op<boost::asio::detail::binder0<libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0>, std::__1::allocator<void>, boost::asio::detail::scheduler_operation>, boost::asio::detail::thread_info_base::default_tag>::allocate(unsigned long) /usr/include/boost/asio/detail/recycling_allocator.hpp:52:15
#5 0x7f698b749124 in boost::asio::detail::executor_op<boost::asio::detail::binder0<libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0>, std::__1::allocator<void>, boost::asio::detail::scheduler_operation>::ptr::allocate(std::__1::allocator<void> const&) /usr/include/boost/asio/detail/executor_op.hpp:35:3
#6 0x7f698b749124 in void boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>::execute<boost::asio::detail::binder0<libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0> >(boost::asio::detail::binder0<libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0>&&) const /usr/include/boost/asio/impl/io_context.hpp:307:7
#7 0x7f698b749124 in std::__1::enable_if<(call_traits<boost_asio_execution_execute_fn::impl, boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, void (boost::asio::detail::binder0<libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0>)>::overload) == ((boost_asio_execution_execute_fn::overload_type)0), boost_asio_execution_execute_fn::call_traits<boost_asio_execution_execute_fn::impl, boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, void (boost::asio::detail::binder0<libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0>), void, void, void, void, void>::result_type>::type boost_asio_execution_execute_fn::impl::operator()<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, boost::asio::detail::binder0<libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0> >(boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>&&, boost::asio::detail::binder0<libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0>&&) const /usr/include/boost/asio/execution/execute.hpp:208:39
#8 0x7f698b749124 in void boost::asio::detail::initiate_post_with_executor<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u> >::operator()<libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0>(libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0&&, std::__1::enable_if<execution::is_executor<std::__1::conditional<true, boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0>::type>::value, void>::type*, std::__1::enable_if<!(detail::is_work_dispatcher_required<std::__1::decay<libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0>::type, boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u> >::value), void>::type*) const /usr/include/boost/asio/impl/post.hpp:122:5
#9 0x7f698b749124 in void boost::asio::detail::completion_handler_async_result<libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0, void ()>::initiate<boost::asio::detail::initiate_post_with_executor<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u> >, libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0>(boost::asio::detail::initiate_post_with_executor<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u> >&&, libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0&&) /usr/include/boost/asio/async_result.hpp:476:5
#10 0x7f698b749124 in boost::asio::constraint<detail::async_result_has_initiate_memfn<libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0, void ()>::value, decltype(async_result<std::__1::decay<libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0>::type, void ()>::initiate(declval<boost::asio::detail::initiate_post_with_executor<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u> >&&>(), declval<libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0&&>()))>::type boost::asio::async_initiate<libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0, void (), boost::asio::detail::initiate_post_with_executor<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u> > >(boost::asio::detail::initiate_post_with_executor<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u> >&&, libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0&) /usr/include/boost/asio/async_result.hpp:855:10
#11 0x7f698b749124 in auto boost::asio::post<boost::asio::io_context, libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0>(boost::asio::io_context&, libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&)::$_0&&, boost::asio::constraint<is_convertible<boost::asio::io_context&, boost::asio::execution_context&>::value, int>::type) /usr/include/boost/asio/impl/post.hpp:247:10
#12 0x7f698b749124 in libtorrent::mmap_disk_io::add_completed_jobs_impl(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&) /usr/src/debug/net-libs/libtorrent-rasterbar-2.0.4-r4/libtorrent-rasterbar-2.0.4/src/mmap_disk_io.cpp:1745:4
#13 0x7f698b747194 in libtorrent::mmap_disk_io::add_completed_jobs(libtorrent::tailqueue<libtorrent::aux::disk_io_job>&) /usr/src/debug/net-libs/libtorrent-rasterbar-2.0.4-r4/libtorrent-rasterbar-2.0.4/src/mmap_disk_io.cpp:1666:4
#14 0x7f698b747194 in libtorrent::mmap_disk_io::execute_job(libtorrent::aux::disk_io_job*) /usr/src/debug/net-libs/libtorrent-rasterbar-2.0.4-r4/libtorrent-rasterbar-2.0.4/src/mmap_disk_io.cpp:1454:4
#15 0x7f698b747f8b in libtorrent::mmap_disk_io::thread_fun(libtorrent::mmap_disk_io::job_queue&, libtorrent::aux::disk_io_thread_pool&) /usr/src/debug/net-libs/libtorrent-rasterbar-2.0.4-r4/libtorrent-rasterbar-2.0.4/src/mmap_disk_io.cpp:1571:4
#16 0x7f698b74b583 in libtorrent::mmap_disk_io::job_queue::thread_fun(libtorrent::aux::disk_io_thread_pool&, boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, void, void>) /usr/src/debug/net-libs/libtorrent-rasterbar-2.0.4-r4/libtorrent-rasterbar-2.0.4/src/mmap_disk_io.cpp:248:12
#17 0x7f698c16f55b in start /usr/src/debug/sys-libs/musl-1.2.2-r3/musl-1.2.2/src/thread/pthread_create.c:203:17
Thread T4 created by T0 here:
#0 0x562b748a83dc in pthread_create (/usr/bin/qbittorrent+0xa703dc)
#1 0x7f698b9efd27 in std::__1::__libcpp_thread_create(unsigned long*, void* (*)(void*), void*) /usr/include/c++/v1/__threading_support:514:10
#2 0x7f698b9efd27 in std::__1::thread::thread<libtorrent::session::start(libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>, libtorrent::session_params&&, boost::asio::io_context*)::$_0, void>(libtorrent::session::start(libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>, libtorrent::session_params&&, boost::asio::io_context*)::$_0&&) /usr/include/c++/v1/thread:307:16
#3 0x7f698b9efd27 in std::__1::__shared_ptr_emplace<std::__1::thread, std::__1::allocator<std::__1::thread> >::__shared_ptr_emplace<libtorrent::session::start(libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>, libtorrent::session_params&&, boost::asio::io_context*)::$_0>(std::__1::allocator<std::__1::thread>, libtorrent::session::start(libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>, libtorrent::session_params&&, boost::asio::io_context*)::$_0&&) /usr/include/c++/v1/__memory/shared_ptr.h:298:37
#4 0x7f698b9efd27 in std::__1::shared_ptr<std::__1::thread> std::__1::allocate_shared<std::__1::thread, std::__1::allocator<std::__1::thread>, libtorrent::session::start(libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>, libtorrent::session_params&&, boost::asio::io_context*)::$_0, void>(std::__1::allocator<std::__1::thread> const&, libtorrent::session::start(libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>, libtorrent::session_params&&, boost::asio::io_context*)::$_0&&) /usr/include/c++/v1/__memory/shared_ptr.h:1106:55
#5 0x7f698b9efd27 in std::__1::shared_ptr<std::__1::thread> std::__1::make_shared<std::__1::thread, libtorrent::session::start(libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>, libtorrent::session_params&&, boost::asio::io_context*)::$_0, void>(libtorrent::session::start(libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>, libtorrent::session_params&&, boost::asio::io_context*)::$_0&&) /usr/include/c++/v1/__memory/shared_ptr.h:1115:12
#6 0x7f698b9efd27 in libtorrent::session::start(libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>, libtorrent::session_params&&, boost::asio::io_context*) /usr/src/debug/net-libs/libtorrent-rasterbar-2.0.4-r4/libtorrent-rasterbar-2.0.4/src/session.cpp:343:15
#7 0x7f698b9f0fe7 in libtorrent::session::session(libtorrent::session_params const&) /usr/src/debug/net-libs/libtorrent-rasterbar-2.0.4-r4/libtorrent-rasterbar-2.0.4/src/session.cpp:368:3
#8 0x562b7497da41 in BitTorrent::Session::initializeNativeSession() /usr/src/debug/net-p2p/qbittorrent-enhanced-4.3.9.10/qBittorrent-Enhanced-Edition-release-4.3.9.10/src/base/bittorrent/session.cpp:1178:27
#9 0x562b74973201 in BitTorrent::Session::Session(QObject*) /usr/src/debug/net-p2p/qbittorrent-enhanced-4.3.9.10/qBittorrent-Enhanced-Edition-release-4.3.9.10/src/base/bittorrent/session.cpp:494:5
#10 0x562b749996e7 in BitTorrent::Session::initInstance() /usr/src/debug/net-p2p/qbittorrent-enhanced-4.3.9.10/qBittorrent-Enhanced-Edition-release-4.3.9.10/src/base/bittorrent/session.cpp:1076:26
#11 0x562b74925f2c in main /usr/src/debug/net-p2p/qbittorrent-enhanced-4.3.9.10/qBittorrent-Enhanced-Edition-release-4.3.9.10/src/app/main.cpp:292:21
#12 0x7f698c115588 in libc_start_main_stage2 /usr/src/debug/sys-libs/musl-1.2.2-r3/musl-1.2.2/src/env/__libc_start_main.c:94:7
Thread T28 created by T4 here:
#0 0x562b748a83dc in pthread_create (/usr/bin/qbittorrent+0xa703dc)
#1 0x7f698b2d8059 in std::__1::__libcpp_thread_create(unsigned long*, void* (*)(void*), void*) /usr/include/c++/v1/__threading_support:514:10
#2 0x7f698b2d8059 in std::__1::thread::thread<void (libtorrent::aux::pool_thread_interface::*)(libtorrent::aux::disk_io_thread_pool&, boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, void, void>), libtorrent::aux::pool_thread_interface*, std::__1::reference_wrapper<libtorrent::aux::disk_io_thread_pool>, boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, void, void>, void>(void (libtorrent::aux::pool_thread_interface::*&&)(libtorrent::aux::disk_io_thread_pool&, boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, void, void>), libtorrent::aux::pool_thread_interface*&&, std::__1::reference_wrapper<libtorrent::aux::disk_io_thread_pool>&&, boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, void, void>&&) /usr/include/c++/v1/thread:307:16
#3 0x7f698b2d7baa in void std::__1::allocator<std::__1::thread>::construct<std::__1::thread, void (libtorrent::aux::pool_thread_interface::*)(libtorrent::aux::disk_io_thread_pool&, boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, void, void>), libtorrent::aux::pool_thread_interface*, std::__1::reference_wrapper<libtorrent::aux::disk_io_thread_pool>, boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, void, void> >(std::__1::thread*, void (libtorrent::aux::pool_thread_interface::*&&)(libtorrent::aux::disk_io_thread_pool&, boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, void, void>), libtorrent::aux::pool_thread_interface*&&, std::__1::reference_wrapper<libtorrent::aux::disk_io_thread_pool>&&, boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, void, void>&&) /usr/include/c++/v1/__memory/allocator.h:154:28
#4 0x7f698b2d7baa in void std::__1::allocator_traits<std::__1::allocator<std::__1::thread> >::construct<std::__1::thread, void (libtorrent::aux::pool_thread_interface::*)(libtorrent::aux::disk_io_thread_pool&, boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, void, void>), libtorrent::aux::pool_thread_interface*, std::__1::reference_wrapper<libtorrent::aux::disk_io_thread_pool>, boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, void, void>, void>(std::__1::allocator<std::__1::thread>&, std::__1::thread*, void (libtorrent::aux::pool_thread_interface::*&&)(libtorrent::aux::disk_io_thread_pool&, boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, void, void>), libtorrent::aux::pool_thread_interface*&&, std::__1::reference_wrapper<libtorrent::aux::disk_io_thread_pool>&&, boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, void, void>&&) /usr/include/c++/v1/__memory/allocator_traits.h:290:13
#5 0x7f698b2d7baa in void std::__1::vector<std::__1::thread, std::__1::allocator<std::__1::thread> >::__emplace_back_slow_path<void (libtorrent::aux::pool_thread_interface::*)(libtorrent::aux::disk_io_thread_pool&, boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, void, void>), libtorrent::aux::pool_thread_interface*, std::__1::reference_wrapper<libtorrent::aux::disk_io_thread_pool>, boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, void, void> >(void (libtorrent::aux::pool_thread_interface::*&&)(libtorrent::aux::disk_io_thread_pool&, boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, void, void>), libtorrent::aux::pool_thread_interface*&&, std::__1::reference_wrapper<libtorrent::aux::disk_io_thread_pool>&&, boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, void, void>&&) /usr/include/c++/v1/vector:1689:5
#6 0x7f698b2c6165 in void std::__1::vector<std::__1::thread, std::__1::allocator<std::__1::thread> >::emplace_back<void (libtorrent::aux::pool_thread_interface::*)(libtorrent::aux::disk_io_thread_pool&, boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, void, void>), libtorrent::aux::pool_thread_interface*, std::__1::reference_wrapper<libtorrent::aux::disk_io_thread_pool>, boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, void, void> >(void (libtorrent::aux::pool_thread_interface::*&&)(libtorrent::aux::disk_io_thread_pool&, boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, void, void>), libtorrent::aux::pool_thread_interface*&&, std::__1::reference_wrapper<libtorrent::aux::disk_io_thread_pool>&&, boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>, void, void>&&) /usr/include/c++/v1/vector:1709:9
#7 0x7f698b73bee7 in libtorrent::mmap_disk_io::submit_jobs() /usr/src/debug/net-libs/libtorrent-rasterbar-2.0.4-r4/libtorrent-rasterbar-2.0.4/src/mmap_disk_io.cpp:1431:22
#8 0x7f698bb062c4 in libtorrent::aux::session_impl::deferred_submit_jobs()::$_4::operator()() const /usr/src/debug/net-libs/libtorrent-rasterbar-2.0.4-r4/libtorrent-rasterbar-2.0.4/src/session_impl.cpp:1395:13
#9 0x7f698bb062c4 in void libtorrent::aux::allocating_handler<libtorrent::aux::session_impl::deferred_submit_jobs()::$_4, 72ul, (libtorrent::aux::HandlerName)7>::operator()<>() /usr/src/debug/net-libs/libtorrent-rasterbar-2.0.4-r4/libtorrent-rasterbar-2.0.4/include/libtorrent/aux_/allocating_handler.hpp:268:5
#10 0x7f698bb062c4 in boost::asio::detail::binder0<libtorrent::aux::allocating_handler<libtorrent::aux::session_impl::deferred_submit_jobs()::$_4, 72ul, (libtorrent::aux::HandlerName)7> >::operator()() /usr/include/boost/asio/detail/bind_handler.hpp:60:5
#11 0x7f698bb062c4 in void boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::binder0<libtorrent::aux::allocating_handler<libtorrent::aux::session_impl::deferred_submit_jobs()::$_4, 72ul, (libtorrent::aux::HandlerName)7> >, boost::asio::detail::binder0<libtorrent::aux::allocating_handler<libtorrent::aux::session_impl::deferred_submit_jobs()::$_4, 72ul, (libtorrent::aux::HandlerName)7> > >(boost::asio::detail::binder0<libtorrent::aux::allocating_handler<libtorrent::aux::session_impl::deferred_submit_jobs()::$_4, 72ul, (libtorrent::aux::HandlerName)7> >&, boost::asio::detail::binder0<libtorrent::aux::allocating_handler<libtorrent::aux::session_impl::deferred_submit_jobs()::$_4, 72ul, (libtorrent::aux::HandlerName)7> >&) /usr/include/boost/asio/detail/handler_invoke_helpers.hpp:51:3
#12 0x7f698bb0662f in boost::asio::detail::executor_op<boost::asio::detail::binder0<libtorrent::aux::allocating_handler<libtorrent::aux::session_impl::deferred_submit_jobs()::$_4, 72ul, (libtorrent::aux::HandlerName)7> >, libtorrent::aux::handler_allocator<int, 72ul, (libtorrent::aux::HandlerName)7>, boost::asio::detail::scheduler_operation>::do_complete(void*, boost::asio::detail::scheduler_operation*, boost::system::error_code const&, unsigned long) /usr/include/boost/asio/detail/executor_op.hpp:70:7
#13 0x7f698b29434c in boost::asio::detail::scheduler_operation::complete(void*, boost::system::error_code const&, unsigned long) /usr/include/boost/asio/detail/scheduler_operation.hpp:40:5
#14 0x7f698b29434c in boost::asio::detail::scheduler::do_run_one(boost::asio::detail::conditionally_enabled_mutex::scoped_lock&, boost::asio::detail::scheduler_thread_info&, boost::system::error_code const&) /usr/include/boost/asio/detail/impl/scheduler.ipp:486:12
#15 0x7f698b292ee3 in boost::asio::detail::scheduler::run(boost::system::error_code&) /usr/include/boost/asio/detail/impl/scheduler.ipp:204:10
#16 0x7f698b9f4ad3 in boost::asio::io_context::run() /usr/include/boost/asio/impl/io_context.ipp:63:24
#17 0x7f698b9f4ad3 in libtorrent::session::start(libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>, libtorrent::session_params&&, boost::asio::io_context*)::$_0::operator()() const /usr/src/debug/net-libs/libtorrent-rasterbar-2.0.4-r4/libtorrent-rasterbar-2.0.4/src/session.cpp:344:14
#18 0x7f698b9f4ad3 in decltype(static_cast<libtorrent::session::start(libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>, libtorrent::session_params&&, boost::asio::io_context*)::$_0>(fp)()) std::__1::__invoke<libtorrent::session::start(libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>, libtorrent::session_params&&, boost::asio::io_context*)::$_0>(libtorrent::session::start(libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>, libtorrent::session_params&&, boost::asio::io_context*)::$_0&&) /usr/include/c++/v1/type_traits:3918:1
#19 0x7f698b9f4ad3 in void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, libtorrent::session::start(libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>, libtorrent::session_params&&, boost::asio::io_context*)::$_0>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, libtorrent::session::start(libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>, libtorrent::session_params&&, boost::asio::io_context*)::$_0>&, std::__1::__tuple_indices<>) /usr/include/c++/v1/thread:280:5
#20 0x7f698b9f4ad3 in void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, libtorrent::session::start(libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>, libtorrent::session_params&&, boost::asio::io_context*)::$_0> >(void*) /usr/include/c++/v1/thread:291:5
#21 0x7f698c16f55b in start /usr/src/debug/sys-libs/musl-1.2.2-r3/musl-1.2.2/src/thread/pthread_create.c:203:17
SUMMARY: AddressSanitizer: bad-free (/usr/bin/qbittorrent+0xa81882) in free
==4357==ABORTING
clang 13 + libstdc++ + glibc: work fine
clang 13 + libstdc++ + glibc: work fine
I'm a little curious now. What about clang + libc++ + glibc? Meaning, is it libc++ or musl that triggers it? My bet is on libc++, but who knows, right?
My system don't have gcc installed and all packages are built use musl libc, libc++ and libc++abi and clang/clang++ as compiler from source code.
^ https://bugs.gentoo.org/815145#c6
So, I guess, it's the same or similar in OpenBSD. @arvidn that might be why you can't reproduce it on ubuntu.
OpenBSD uses Clang + libc++ + libc++abi.
To me it would seem there is something up between Boost Asio and libc++.
it looks like this may be related to this issue: https://github.com/arvidn/libtorrent/issues/6567
That could be confirmed if they clarify the cxx standard used is 14 and if using 17 fixes it. I could not tell from looking here
https://packages.gentoo.org/packages/net-libs/libtorrent-rasterbar
Not sure it's related, really. In #6567 it's built with gcc, so it's likely a separate issue. To reproduce this one libtorrent has to be built with clang.
I recompile libtorrent with c++ 17, it don't crash anymore. ( musl 1.2.2 + Clang 13.0.0 + libc++ 13.0.0 )
Well, I guess that proves me wrong. :-)
@corvus1 the entire issue here https://github.com/arvidn/libtorrent/issues/6567 is Alpine Linux related and Alpine does not use glibc and is musl based. You are only wrong in the sense you thought we were using glibc.
We established that there is a cxx14 issue that probably filters down to something specific with libtorrent + boost + musl and it appears @12101111 has confirmed the issue is one and the same for both scenarios, meaning it's potentially a musl problem with cxx14 across any Linux distribution
But OpenBSD don't use musl, this should just a issue of cxx14
@12101111 on Debian based platforms using glibc there is no issue with cxx14 so maybe a more correct way to say this
libtorrent + boost + not glibc ?
@12101111 on Debian based platforms using glibc there is no issue with cxx14 so maybe a more correct way to say this
libtorrent + boost + not glibc ?
libtorrent + boost Asio + libc++
I recompile libtorrent with c++ 17, it don't crash anymore. ( musl 1.2.2 + Clang 13.0.0 + libc++ 13.0.0 )
The build was defaulting to C++14. I built libtorrent-rasterbar with C++17 and indeed it is no longer crashing.
It'll be interesting to see if this goes away after updating to LLVM / Clang 16 or newer.
libtorrent-rasterbar 1.2.13
OpenBSD/amd64
Clang 11.1.0
When OpenBSD upgraded from Boost 1.76 to 1.77 we noticed some libtorrent-rasterbar torrent clients crashing upon startup..
The crashing is coming from libtorrent-rasterbar.
I noticed rebuilding libtorrent-rasterbar with -O1 instead of the default -O2 and it stopped crashing.