arvidn / libtorrent

an efficient feature complete C++ bittorrent implementation
http://libtorrent.org
Other
5.17k stars 995 forks source link

libtorrent-rasterbar 1.2.13 crashing with Boost 1.77 #6468

Open brad0 opened 3 years ago

brad0 commented 3 years ago

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..

$ deluge-gtk
python3.8(31669) in free(): bogus pointer (double free?) 0x1c0000002400

$ qbittorrent
qbittorrent(46686) in free(): bogus pointer (double free?) 0xcabaacf5eb495c7c

The crashing is coming from libtorrent-rasterbar.

I noticed rebuilding libtorrent-rasterbar with -O1 instead of the default -O2 and it stopped crashing.

humpty$ egdb qbittorrent qbittorrent.core
GNU gdb (GDB) 7.12.1
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-openbsd7.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from qbittorrent...(no debugging symbols found)...done.
[New process 457065]
[New process 247188]
[New process 350055]
[New process 417451]
[New process 159947]
[New process 595077]
[New process 579455]
[New process 116180]
[New process 513611]
[New process 255205]
[New process 155000]
[New process 114726]
[New process 517451]
[New process 504415]
[New process 614544]
Core was generated by `qbittorrent'.
Program terminated with signal SIGABRT, Aborted.
#0  thrkill () at /tmp/-:3
3       /tmp/-: No such file or directory.
[Current thread is 1 (process 457065)]
(gdb) bt full
#0  thrkill () at /tmp/-:3
No locals.
#1  0x00000a20dc3fc17e in _libc_abort () at /usr/src/lib/libc/stdlib/abort.c:51
        sa = {__sigaction_u = {__sa_handler = 0x3000000010, __sa_sigaction = 0x3000000010}, sa_mask = 944482368, sa_flags = 2592}
        mask = 4294967263
#2  0x00000a20dc417696 in wrterror (d=0xa2113719010, msg=0xa20dc3deaa3 "bogus pointer (double free?) %p") at /usr/src/lib/libc/stdlib/malloc.c:307
        ap = {{gp_offset = 24, fp_offset = 48, overflow_arg_area = 0xa20384ba940, reg_save_area = 0xa20384ba840}}
        saved_errno = 22
#3  0x00000a20dc41aec6 in findpool (p=0x0, argpool=<optimized out>, foundpool=0xa20384ba9c0, saved_function=0xa20384ba9c8) at /usr/src/lib/libc/stdlib/malloc.c:1332
        nmutexes = <optimized out>
        i = <optimized out>
        pool = <optimized out>
        r = <optimized out>
#4  0x00000a20dc417995 in ofree (argpool=0xa20384baa30, p=0x93359876b85edd2b, clear=0, check=0, argsz=0) at /usr/src/lib/libc/stdlib/malloc.c:1346
        saved_function = 0x7829ed828d90f8d2 <error: Cannot access memory at address 0x7829ed828d90f8d2>
        pool = 0x0
        r = <optimized out>
        sz = <optimized out>
#5  0x00000a20dc4178db in free (ptr=0x93359876b85edd2b) at /usr/src/lib/libc/stdlib/malloc.c:1470
        saved_errno = 22
        d = 0xa2113719010
#6  0x00000a20a529ddcc in boost::alignment::aligned_free (ptr=0xa21076eea00) at /usr/local/include/boost/align/detail/aligned_alloc.hpp:45
No locals.
#7  boost::asio::aligned_delete (ptr=0xa21076eea00) at /usr/local/include/boost/asio/detail/memory.hpp:124
No locals.
#8  boost::asio::detail::thread_info_base::deallocate<boost::asio::detail::thread_info_base::default_tag> (this_thread=<optimized out>, pointer=<optimized out>, size=<optimized out>) at /usr/local/include/boost/asio/detail/thread_info_base.hpp:198
No locals.
#9  boost::asio::detail::thread_info_base::deallocate (this_thread=<optimized out>, pointer=<optimized out>, size=<optimized out>) at /usr/local/include/boost/asio/detail/thread_info_base.hpp:129
No locals.
#10 boost::asio::asio_handler_deallocate (pointer=0xa21076eea00, size=<optimized out>) at /usr/local/include/boost/asio/impl/handler_alloc_hook.ipp:51
No locals.
#11 boost_asio_handler_alloc_helpers::deallocate<void libtorrent::session_handle::async_call<void (libtorrent::aux::session_impl::*)(std::__1::shared_ptr<libtorrent::plugin>), std::__1::shared_ptr<libtorrent::plugin>&>(void (libtorrent::aux::session_impl::*)(std::__1::shared_ptr<libtorrent::plugin>), std::__1::shared_ptr<libtorrent::plugin>&) const::{lambda()#1}>(void*, unsigned long, void libtorrent::session_handle::async_call<void (libtorrent::aux::session_impl::*)(std::__1::shared_ptr<libtorrent::plugin>), std::__1::shared_ptr<libtorrent::plugin>&>(void (libtorrent::aux::session_impl::*)(std::__1::shared_ptr<libtorrent::plugin>), std::__1::shared_ptr<libtorrent::plugin>&) const::{lambda()#1}&) (p=0xa21076eea00, s=<optimized out>, h=...)
    at /usr/local/include/boost/asio/detail/handler_alloc_helpers.hpp:95
No locals.
#12 boost::asio::detail::hook_allocator<void libtorrent::session_handle::async_call<void (libtorrent::aux::session_impl::*)(std::__1::shared_ptr<libtorrent::plugin>), std::__1::shared_ptr<libtorrent::plugin>&>(void (libtorrent::aux::session_impl::*)(std::__1::shared_ptr<libtorrent::plugin>), std::__1::shared_ptr<libtorrent::plugin>&) const::{lambda()#1}, boost::asio::detail::completion_handler<{lambda()#1}, boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u> > >::deallocate(boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u>*, unsigned long) (this=<optimized out>, p=0xa21076eea00, n=<error reading variable: Cannot access memory at address 0x1>) at /usr/local/include/boost/asio/detail/handler_alloc_helpers.hpp:137
No locals.
#13 boost::asio::detail::completion_handler<void libtorrent::session_handle::async_call<void (libtorrent::aux::session_impl::*)(std::__1::shared_ptr<libtorrent::plugin>), std::__1::shared_ptr<libtorrent::plugin>&>(void (libtorrent::aux::session_impl::*)(std::__1::shared_ptr<libtorrent::plugin>), std::__1::shared_ptr<libtorrent::plugin>&) const::{lambda()#1}, boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u> >::ptr::reset() (this=0xa20384baad0) at /usr/local/include/boost/asio/detail/completion_handler.hpp:35
No locals.
#14 0x00000a20a529dbd8 in boost::asio::detail::completion_handler<void libtorrent::session_handle::async_call<void (libtorrent::aux::session_impl::*)(std::__1::shared_ptr<libtorrent::plugin>), std::__1::shared_ptr<libtorrent::plugin>&>(void (libtorrent::aux::session_impl::*)(std::__1::shared_ptr<libtorrent::plugin>), std::__1::shared_ptr<libtorrent::plugin>&) const::{lambda()#1}, boost::asio::io_context::basic_executor_type<std::__1::allocator<void>, 0u> >::do_complete(void*, boost::asio::detail::scheduler_operation*, boost::system::error_code const&, unsigned long) (owner=0xa20f3f37900, base=0x6) at /usr/local/include/boost/asio/detail/completion_handler.hpp:67
        p = {h = 0xa20384baaa0, v = 0xa21076eea00, p = 0x0}
        handler = {s = {__ptr_ = 0xa210102d020, __cntrl_ = 0xa210102d000}, f = (void (libtorrent::aux::session_impl::*)(libtorrent::aux::session_impl * const,
    std::__1::shared_ptr<libtorrent::plugin>)) 0xa20a52ae8d0 <libtorrent::aux::session_impl::add_ses_extension(std::__1::shared_ptr<libtorrent::plugin>)>, a = {__ptr_ = 0xa2081db7578, __cntrl_ = 0xa2081db7560}}
        h = 0x6
#15 0x00000a20a511e079 in boost::asio::detail::scheduler_operation::complete (this=0xa21076eea00, owner=0xa20f3f37900, ec=..., bytes_transferred=11136250790538) at /usr/local/include/boost/asio/detail/scheduler_operation.hpp:40
No locals.
#16 boost::asio::detail::scheduler::do_run_one (this=0xa20f3f37900, lock=..., this_thread=..., ec=...) at /usr/local/include/boost/asio/detail/impl/scheduler.ipp:486
        on_exit = {scheduler_ = 0xa20f3f37900, lock_ = 0xa20384bac38, this_thread_ = 0xa20384baba0}
        task_result = <optimized out>
        o = 0xa21076eea00
#17 0x00000a20a511daa1 in boost::asio::detail::scheduler::run (this=0xa20f3f37900, ec=...) at /usr/local/include/boost/asio/detail/impl/scheduler.ipp:204
        this_thread = {<boost::asio::detail::thread_info_base> = {<boost::asio::detail::noncopyable> = {<No data fields>}, reusable_memory_ = {0xa209e043900, 0xa209e060b00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, has_pending_exception_ = 0, pending_exception_ = {
              __ptr_ = 0x0}}, private_op_queue = {<boost::asio::detail::noncopyable> = {<No data fields>}, front_ = 0x0, back_ = 0x0}, private_outstanding_work = 0}
        ctx = {<boost::asio::detail::noncopyable> = {<No data fields>}, key_ = 0xa20f3f37900, value_ = 0xa20384baba0, next_ = 0x0}
        lock = {<boost::asio::detail::noncopyable> = {<No data fields>}, mutex_ = @0xa20f3f37930, locked_ = false}
        n = 4
#18 0x00000a20a52837a6 in boost::asio::io_context::run (this=0x0) at /usr/local/include/boost/asio/impl/io_context.ipp:63
        ec = {{d1_ = {val_ = 0, cat_ = 0x0}, d2_ = '\000' <repeats 15 times>}, flags_ = 0}
#19 libtorrent::session::start(libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>, libtorrent::session_params&&, boost::asio::io_context*)::$_0::operator()() const (this=<optimized out>) at session.cpp:363
No locals.
#20 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> (__f=<optimized out>) at /usr/include/c++/v1/type_traits:3899
No locals.
#21 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<>) (__t=...) at /usr/include/c++/v1/thread:280
No locals.
#22 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*) (__vp=0xa2036726800) at /usr/include/c++/v1/thread:291
        __p = <optimized out>
#23 0x00000a20f1caef01 in _rthread_start (v=<error reading variable: Unhandled dwarf expression opcode 0xa3>) at /usr/src/lib/librthread/rthread.c:96
        thread = <optimized out>
---Type <return> to continue, or q <return> to quit---
        retval = <optimized out>
#24 0x00000a20dc46240a in __tfork_thread () at /usr/src/lib/libc/arch/amd64/sys/tfork_thread.S:84
arvidn commented 2 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.

brad0 commented 2 years ago

Weird how I saw a post notification from GitHub for a post from Elias but it doesn't show in the issue.

marianielias commented 2 years ago

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.

brad0 commented 2 years ago

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.

brad0 commented 2 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.

Any comment on what Elias has posted?

arvidn commented 2 years ago

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 #defines than libtorrent, is there?

corvus1 commented 2 years ago

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.

brad0 commented 2 years ago

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.

arvidn commented 2 years ago

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)

corvus1 commented 2 years ago

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.

corvus1 commented 2 years ago

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.

12101111 commented 2 years ago

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

corvus1 commented 2 years ago

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?

brad0 commented 2 years ago

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.

brad0 commented 2 years ago

To me it would seem there is something up between Boost Asio and libc++.

arvidn commented 2 years ago

it looks like this may be related to this issue: https://github.com/arvidn/libtorrent/issues/6567

userdocs commented 2 years ago

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

userdocs commented 2 years ago

I think i found it maybe? from here https://gitweb.gentoo.org/repo/gentoo.git/log/net-libs/libtorrent-rasterbar

https://gitweb.gentoo.org/repo/gentoo.git/commit/net-libs/libtorrent-rasterbar?id=a514c2b395994d3e4649bfb02dfa8289f51f1ff3

corvus1 commented 2 years ago

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.

12101111 commented 2 years ago

I recompile libtorrent with c++ 17, it don't crash anymore. ( musl 1.2.2 + Clang 13.0.0 + libc++ 13.0.0 )

corvus1 commented 2 years ago

Well, I guess that proves me wrong. :-)

userdocs commented 2 years ago

@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

12101111 commented 2 years ago

But OpenBSD don't use musl, this should just a issue of cxx14

userdocs commented 2 years ago

@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 ?

brad0 commented 2 years ago

@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++

brad0 commented 2 years ago

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.

brad0 commented 1 year ago

It'll be interesting to see if this goes away after updating to LLVM / Clang 16 or newer.