Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault after some time with "Corrupted Double-Linked List" #7769

Open
autogris opened this issue Oct 26, 2024 · 9 comments
Open

Comments

@autogris
Copy link

autogris commented Oct 26, 2024

libtorrent version (or branch):
Version 2.0.11 from this commit 24e658a

platform/architecture:
Linux x86_64

compiler and compiler version:
gcc 14.2.0

please describe what symptom you see, what you would expect to see instead and
how to reproduce it.
Running libtorrent from Deluged, it crashes after some time with "Corrupted Double-Linked List". Dmesg reports deluged[9861]: segfault at 7f010000000f ip 00007fba1c6a7427 sp 00007ffc38d91810 error 4 in libc-2.40.so[a7427,7fba1c628000+17c000] likely on CPU 2 (core 2, socket 0). No torrent were added or removed during the process, but it is already managing around 300 torrents, some paused, some active.

Starting program:
/usr/bin/python3 /usr/bin/deluged -d

This is a backtrace of crashing

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[Detaching after vfork from child process 17010]
[Detaching after vfork from child process 17011]
[Detaching after vfork from child process 17012]
[New Thread 0x7ffff34006c0 (LWP 17013)]
[New Thread 0x7ffff2a006c0 (LWP 17014)]
[New Thread 0x7ffff20006c0 (LWP 17015)]
[New Thread 0x7ffff16006c0 (LWP 17016)]
[New Thread 0x7fffeb6006c0 (LWP 17017)]
[New Thread 0x7fffeac006c0 (LWP 17018)]
[New Thread 0x7fffea2006c0 (LWP 17019)]
[New Thread 0x7fffe98006c0 (LWP 17020)]
[New Thread 0x7fffe8e006c0 (LWP 17021)]
[New Thread 0x7fffdfe006c0 (LWP 17022)]
[New Thread 0x7fffdf4006c0 (LWP 17023)]
[New Thread 0x7fffdea006c0 (LWP 17024)]
[Thread 0x7ffff20006c0 (LWP 17015) exited]
[New Thread 0x7ffff20006c0 (LWP 17027)]
[Thread 0x7fffe8e006c0 (LWP 17021) exited]
[Thread 0x7fffe98006c0 (LWP 17020) exited]
[Thread 0x7fffeb6006c0 (LWP 17017) exited]
[Thread 0x7fffdea006c0 (LWP 17024) exited]
[Thread 0x7fffdf4006c0 (LWP 17023) exited]
[New Thread 0x7fffdf4006c0 (LWP 17273)]
info threads
[Thread 0x7fffea2006c0 (LWP 17019) exited]
[Thread 0x7fffeac006c0 (LWP 17018) exited]
[New Thread 0x7fffeac006c0 (LWP 17422)]
[Thread 0x7fffdf4006c0 (LWP 17273) exited]
[New Thread 0x7fffdf4006c0 (LWP 17884)]
[New Thread 0x7fffea2006c0 (LWP 18097)]
[Thread 0x7fffdf4006c0 (LWP 17884) exited]

Thread 2 "python3" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff34006c0 (LWP 17013)]
0x00007ffff74a7427 in _int_malloc () from /lib64/libc.so.6
(gdb) info threads
  Id   Target Id                                   Frame 
  1    Thread 0x7ffff7e65740 (LWP 17007) "python3" 0x00007ffff7495c4f in __futex_abstimed_wait_cancelable64 () from /lib64/libc.so.6
* 2    Thread 0x7ffff34006c0 (LWP 17013) "python3" 0x00007ffff74a7427 in _int_malloc
    () from /lib64/libc.so.6
  3    Thread 0x7ffff2a006c0 (LWP 17014) "python3" 0x00007ffff75151af in poll ()
   from /lib64/libc.so.6
  5    Thread 0x7ffff16006c0 (LWP 17016) "python3" 0x00007ffff7495c4f in __futex_abstimed_wait_cancelable64 () from /lib64/libc.so.6
  11   Thread 0x7fffdfe006c0 (LWP 17022) "python3" 0x00007ffff7495c4f in __futex_abstimed_wait_cancelable64 () from /lib64/libc.so.6
  14   Thread 0x7ffff20006c0 (LWP 17027) "python3" 0x00007ffff7495c4f in __futex_abstimed_wait_cancelable64 () from /lib64/libc.so.6
  16   Thread 0x7fffeac006c0 (LWP 17422) "python3" 0x00007ffff7495c4f in __futex_abstimed_wait_cancelable64 () from /lib64/libc.so.6
  18   Thread 0x7fffea2006c0 (LWP 18097) "python3" 0x00007ffff7495c4f in __futex_abstimed_wait_cancelable64 () from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff74a7427 in _int_malloc () from /lib64/libc.so.6
#1  0x00007ffff74a9279 in malloc () from /lib64/libc.so.6
#2  0x00007ffff4cbb7ec in operator new(unsigned long) ()
   from /usr/lib64/libstdc++.so.6
#3  0x00007ffff5348eb7 in ?? () from /usr/lib64/libtorrent-rasterbar.so.2.0
#4  0x00007ffff53b920f in ?? () from /usr/lib64/libtorrent-rasterbar.so.2.0
#5  0x00007ffff5288898 in ?? () from /usr/lib64/libtorrent-rasterbar.so.2.0
#6  0x00007ffff5288da0 in ?? () from /usr/lib64/libtorrent-rasterbar.so.2.0
#7  0x00007ffff4ce8f24 in ?? () from /usr/lib64/libstdc++.so.6
#8  0x00007ffff749960b in start_thread () from /lib64/libc.so.6
#9  0x00007ffff7522958 in __clone3 () from /lib64/libc.so.6
(gdb) thread 1
[Switching to thread 1 (Thread 0x7ffff7e65740 (LWP 17007))]
#0  0x00007ffff7495c4f in __futex_abstimed_wait_cancelable64 ()
   from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff7495c4f in __futex_abstimed_wait_cancelable64 ()
   from /lib64/libc.so.6
#1  0x00007ffff749859e in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libc.so.6
#2  0x00007ffff528aae4 in ?? () from /usr/lib64/libtorrent-rasterbar.so.2.0
#3  0x00007ffff53b8f79 in std::vector<libtorrent::announce_entry, std::allocator<libtorrent::announce_entry> > libtorrent::torrent_handle::sync_call_ret<std::vector<libtorrent::announce_entry, std::allocator<libtorrent::announce_entry> >, std::vector<libtorrent::announce_entry, std::allocator<libtorrent::announce_entry> > (libtorrent::torrent::*)() const>(std::vector<libtorrent::announce_entry, std::allocator<libtorrent::announce_entry> >, std::vector<libtorrent::announce_entry, std::allocator<libtorrent::announce_entry> > (libtorrent::torrent::*)() const) const ()
   from /usr/lib64/libtorrent-rasterbar.so.2.0
#4  0x00007ffff539fbca in libtorrent::torrent_handle::trackers() const ()
   from /usr/lib64/libtorrent-rasterbar.so.2.0
#5  0x00007ffff59f05ec in trackers(libtorrent::torrent_handle&) ()
   from /usr/lib64/python3.11/site-packages/libtorrent.cpython-311-x86_64-linux-gnu.so
#6  0x00007ffff59fe79e in boost::python::objects::caller_py_function_impl<boost::python::detail::caller<boost::python::list (*)(libtorrent::torrent_handle&), boost::python::default_call_policies, boost::mpl::vector2<boost::python::list, libtorrent::torrent_handle&> > >::operator()(_object*, _object*) ()
   from /usr/lib64/python3.11/site-packages/libtorrent.cpython-311-x86_64-linux-gnu.so
--Type <RET> for more, q to quit, c to continue without paging--
#7  0x00007ffff5c8eff6 in boost::python::objects::function::call(_object*, _object*) const () from /usr/lib64/libboost_python311.so.1.86.0
#8  0x00007ffff5c8f1a8 in ?? () from /usr/lib64/libboost_python311.so.1.86.0
#9  0x00007ffff5c94363 in boost::python::handle_exception_impl(boost::function_n<void>) () from /usr/lib64/libboost_python311.so.1.86.0
#10 0x00007ffff5c8da82 in ?? () from /usr/lib64/libboost_python311.so.1.86.0
#11 0x00007ffff79e57fb in _PyObject_MakeTpCall ()
   from /usr/lib64/libpython3.11.so.1.0
#12 0x00007ffff7a42769 in _PyEval_EvalFrameDefault ()
   from /usr/lib64/libpython3.11.so.1.0
#13 0x00007ffff7a413ac in ?? () from /usr/lib64/libpython3.11.so.1.0
#14 0x00007ffff79e7594 in ?? () from /usr/lib64/libpython3.11.so.1.0
#15 0x00007ffff7a46120 in _PyEval_EvalFrameDefault ()
   from /usr/lib64/libpython3.11.so.1.0
#16 0x00007ffff7a413ac in ?? () from /usr/lib64/libpython3.11.so.1.0
#17 0x00007ffff7a46120 in _PyEval_EvalFrameDefault ()
   from /usr/lib64/libpython3.11.so.1.0
#18 0x00007ffff7a413ac in ?? () from /usr/lib64/libpython3.11.so.1.0
#19 0x00007ffff79e7594 in ?? () from /usr/lib64/libpython3.11.so.1.0
#20 0x00007ffff7a46120 in _PyEval_EvalFrameDefault ()
   from /usr/lib64/libpython3.11.so.1.0
#21 0x00007ffff7a413ac in ?? () from /usr/lib64/libpython3.11.so.1.0
#22 0x00007ffff7a46120 in _PyEval_EvalFrameDefault ()
--Type <RET> for more, q to quit, c to continue without paging--
   from /usr/lib64/libpython3.11.so.1.0
#23 0x00007ffff7a413ac in ?? () from /usr/lib64/libpython3.11.so.1.0
#24 0x00007ffff7abd6ea in PyEval_EvalCode () from /usr/lib64/libpython3.11.so.1.0
#25 0x00007ffff7ad171d in ?? () from /usr/lib64/libpython3.11.so.1.0
#26 0x00007ffff7ad16aa in ?? () from /usr/lib64/libpython3.11.so.1.0
#27 0x00007ffff7ad1ef2 in ?? () from /usr/lib64/libpython3.11.so.1.0
#28 0x00007ffff7ad1cff in _PyRun_SimpleFileObject ()
   from /usr/lib64/libpython3.11.so.1.0
#29 0x00007ffff7ad1854 in _PyRun_AnyFileObject ()
   from /usr/lib64/libpython3.11.so.1.0
#30 0x00007ffff7ad913f in Py_RunMain () from /usr/lib64/libpython3.11.so.1.0
#31 0x00007ffff7ad8dd7 in Py_BytesMain () from /usr/lib64/libpython3.11.so.1.0
#32 0x00007ffff7429d57 in __libc_start_call_main () from /lib64/libc.so.6
#33 0x00007ffff7429e15 in __libc_start_main_impl () from /lib64/libc.so.6
#34 0x0000000000401071 in _start ()

Compiling with AddressSanitizer, I get this log:

=================================================================
==28220==ERROR: AddressSanitizer: heap-use-after-free on address 0x5170004313fc at pc 0x7f9a3c0773a2 bp 0x7f9a3a1fe410 sp 0x7f9a3a1fe408
WRITE of size 28 at 0x5170004313fc thread T1
    #0 0x7f9a3c0773a1  (/usr/lib64/libtorrent-rasterbar.so.2.0+0x4773a1)
    #1 0x7f9a3c1f5799  (/usr/lib64/libtorrent-rasterbar.so.2.0+0x5f5799)
    #2 0x7f9a3c1fa3d3  (/usr/lib64/libtorrent-rasterbar.so.2.0+0x5fa3d3)
    #3 0x7f9a3c87bf04  (/usr/lib64/libtorrent-rasterbar.so.2.0+0xc7bf04)
    #4 0x7f9a3c87d256  (/usr/lib64/libtorrent-rasterbar.so.2.0+0xc7d256)
    #5 0x7f9a428e8f23  (/usr/lib64/libstdc++.so.6+0xe8f23)
    #6 0x7f9a436602d5  (/usr/lib64/libasan.so.8.0.0+0x602d5)
    #7 0x7f9a42c9960a in start_thread (/lib64/libc.so.6+0x9960a)
    #8 0x7f9a42d22957 in __clone3 (/lib64/libc.so.6+0x122957)

0x5170004313fc is located 124 bytes inside of 712-byte region [0x517000431380,0x517000431648)
freed by thread T1 here:
    #0 0x7f9a436fb6f8 in operator delete(void*, unsigned long) (/usr/lib64/libasan.so.8.0.0+0xfb6f8)
    #1 0x7f9a3c07ff86  (/usr/lib64/libtorrent-rasterbar.so.2.0+0x47ff86)

previously allocated by thread T1 here:
    #0 0x7f9a436fa7f8 in operator new(unsigned long) (/usr/lib64/libasan.so.8.0.0+0xfa7f8)
    #1 0x7f9a3c3263ba  (/usr/lib64/libtorrent-rasterbar.so.2.0+0x7263ba)

Thread T1 created by T0 here:
    #0 0x7f9a436f1bb1 in pthread_create (/usr/lib64/libasan.so.8.0.0+0xf1bb1)
    #1 0x7f9a428e8ff8 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/usr/lib64/libstdc++.so.6+0xe8ff8)

SUMMARY: AddressSanitizer: heap-use-after-free (/usr/lib64/libtorrent-rasterbar.so.2.0+0x4773a1) 
Shadow bytes around the buggy address:
  0x517000431100: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x517000431180: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x517000431200: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x517000431280: fd fd fd fd fd fd fd fd fd fd fd fd fa fa fa fa
  0x517000431300: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x517000431380: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd[fd]
  0x517000431400: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x517000431480: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x517000431500: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x517000431580: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x517000431600: fd fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==28220==ABORTING

I should mention that it used to work as expected but I noticed this error for the first time after changing several connections settings, I don't know if it is related or incidental. My system is a rolling-release type, between the last time it worked correctly and first time this error occurred there were several updates but I guess none seems related to dependencies of libtorrent. I also tried compiling different commits up until the official stable release, but no luck.

@autogris
Copy link
Author

Same error occurs with qBittorrent after importing torrents from Deluge. Some torrent data is probably triggering this but I don't know how to find which one specifically is the cause or why. All torrents were completed and seeding for some time when the bug started to occur. Many torrents use a non-latin character script in their naming. Maye there is a corrupted file? But how to find which one, and is there a better way for libtorrent to deal with corrupted files without breaking the whole functioning of the program?

@arvidn
Copy link
Owner

arvidn commented Oct 29, 2024

If you could build with debug symbols and trigger the address sanitizer error, it would probably be very helpful.

It's virtually impossible for me to reproduce your build to resolve those addresses.

@autogris
Copy link
Author

I think I will need a hint on how to proceed. I've compiled libtorrent with cflag -O0 -ggdb -fsanitize=address, and ldflags -fsanitize=address, also cmake flags -Ddebug-symbols=ON. The program still fails, but this time with exit code 1 and no segmentation fault. There is no coredump file, and I can't backtrace because the process ended cleanly. Also trying to put breakpoint on exit didn't prevented it from exiting. I've tried to generate a core file with gcore pid_of_proccess, but the file quickly reached several terabytes and I had to force quit.

@autogris
Copy link
Author

On gdb I've just tried a different break approach: catch syscall exit exit_group, it breaks at the error point but then trying to create a coredump with generate-core-file produces an absurd sized file, forcing me to quit before it fill the the whole disk.

@autogris
Copy link
Author

autogris commented Oct 30, 2024

Package generator was stripping binaries, I fixed that now. Here is what I got from gdb's backtrace running deluged with libtorrent compiled with sanitized address and debug symbols. It appears to be related to the socks5 proxy mechanism:

version: 2.0.11.0-74bc93a37

file: '/tmp/SBo/libtorrent-2.0.11/include/libtorrent/socks5_stream.hpp'
line: 381
function: socks_connect
expression: m_remote_endpoint.address() != address()

stack:
1: libtorrent::print_backtrace(char*, int, int, void*)
2: libtorrent::assert_fail(char const*, int, char const*, char const*, char const*, int)
3: 


Thread 2 "python3" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffee6006c0 (LWP 16785)]
0x00007ffff6c9b3bb in pthread_kill@@GLIBC_2.34 () from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff6c9b3bb in pthread_kill@@GLIBC_2.34 () from /lib64/libc.so.6
#1  0x00007ffff6c43032 in raise () from /lib64/libc.so.6
#2  0x00007ffff02e1e4b in libtorrent::assert_fail (
    expr=0x7ffff09947e8 "m_remote_endpoint.address() != address()", line=381, 
    file=0x7ffff0993020 "/tmp/SBo/libtorrent-2.0.11/include/libtorrent/socks5_stream.hpp", 
    function=0x7ffff09947bc "socks_connect", value=0x0, kind=0)
    at /tmp/SBo/libtorrent-2.0.11/src/assert.cpp:389
#3  0x00007ffff03bdf20 in libtorrent::socks5_stream::socks_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>) (this=0x51b00056e778, h=...)
    at /tmp/SBo/libtorrent-2.0.11/include/libtorrent/socks5_stream.hpp:381
#4  0x00007ffff03d3bf0 in libtorrent::socks5_stream::handshake4<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>) (this=0x51b00056e778, e=..., h=...)
    at /tmp/SBo/libtorrent-2.0.11/include/libtorrent/socks5_stream.hpp:352
#5  0x00007ffff03cbd53 in libtorrent::socks5_stream::handshake3<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)::{lambda(boost::system::error_code const&, unsigned long, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}::operator()(boost::system::error_code const&, unsigned long, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>) const (__closure=0x7fffee5ff958, ec=..., hn=...)
    at /tmp/SBo/libtorrent-2.0.11/include/libtorrent/socks5_stream.hpp:323
#6  0x00007ffff04033eb in libtorrent::wrap_allocator_t<libtorrent::socks5_stream::handshake3<std::_Bind<void (l--Type <RET> for more, q to quit, c to continue without paging--c
ibtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)::{lambda(boost::system::error_code const&, unsigned long, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >::operator()<boost::system::error_code const&, unsigned long const&>(boost::system::error_code const&, unsigned long const&) (this=0x7fffee5ff958)
    at /tmp/SBo/libtorrent-2.0.11/include/libtorrent/proxy_base.hpp:316
#7  0x00007ffff03faf6d in boost::asio::detail::read_op<libtorrent::aux::noexcept_movable<libtorrent::aux::noexcept_move_only<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor> > >, boost::asio::mutable_buffer, boost::asio::mutable_buffer const*, boost::asio::detail::transfer_all_t, libtorrent::wrap_allocator_t<libtorrent::socks5_stream::handshake3<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)::{lambda(boost::system::error_code const&, unsigned long, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >::operator()(boost::system::error_code, unsigned long, int) (this=0x7fffee5ff930, ec=..., bytes_transferred=2, start=0)
    at /usr/include/boost/asio/impl/read.hpp:415
#8  0x00007ffff04426e7 in boost::asio::detail::binder2<boost::asio::detail::read_op<libtorrent::aux::noexcept_movable<libtorrent::aux::noexcept_move_only<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor> > >, boost::asio::mutable_buffer, boost::asio::mutable_buffer const*, boost::asio::detail::transfer_all_t, libtorrent::wrap_allocator_t<libtorrent::socks5_stream::handshake3<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)::{lambda(boost::system::error_code const&, unsigned long, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >, boost::system::error_code, unsigned long>::operator()() (this=0x7fffee5ff930)
    at /usr/include/boost/asio/detail/bind_handler.hpp:181
#9  0x00007ffff0449869 in boost::asio::basic_system_executor<boost::asio::execution::detail::blocking::possibly_t<0>, boost::asio::execution::detail::relationship::fork_t<0>, std::allocator<void> >::do_execute<boost::asio::detail::binder2<boost::asio::detail::read_op<libtorrent::aux::noexcept_movable<libtorrent::aux::noexcept_move_only<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor> > >, boost::asio::mutable_buffer, boost::asio::mutable_buffer const*, boost::asio::detail::transfer_all_t, libtorrent::wrap_allocator_t<libtorrent::socks5_stream::handshake3<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)::{lambda(boost::system::error_code const&, unsigned long, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >, boost::system::error_code, unsigned long> >(boost::asio::detail::binder2<boost::asio::detail::read_op<libtorrent::aux::noexcept_movable<libtorrent::aux::noexcept_move_only<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor> > >, boost::asio::mutable_buffer, boost::asio::mutable_buffer const*, boost::asio::detail::transfer_all_t, libtorrent::wrap_allocator_t<libtorrent::socks5_stream::handshake3<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)::{lambda(boost::system::error_code const&, unsigned long, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >, boost::system::error_code, unsigned long>&&, boost::asio::execution::detail::blocking::possibly_t<0>) const (this=0x7fffee5ff8ad, f=...) at /usr/include/boost/asio/impl/system_executor.hpp:58
#10 0x00007ffff044699f in boost::asio::basic_system_executor<boost::asio::execution::detail::blocking::possibly_t<0>, boost::asio::execution::detail::relationship::fork_t<0>, std::allocator<void> >::execute<boost::asio::detail::binder2<boost::asio::detail::read_op<libtorrent::aux::noexcept_movable<libtorrent::aux::noexcept_move_only<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor> > >, boost::asio::mutable_buffer, boost::asio::mutable_buffer const*, boost::asio::detail::transfer_all_t, libtorrent::wrap_allocator_t<libtorrent::socks5_stream::handshake3<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)::{lambda(boost::system::error_code const&, unsigned long, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >, boost::system::error_code, unsigned long> >(boost::asio::detail::binder2<boost::asio::detail::read_op<libtorrent::aux::noexcept_movable<libtorrent::aux::noexcept_move_only<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor> > >, boost::asio::mutable_buffer, boost::asio::mutable_buffer const*, boost::asio::detail::transfer_all_t, libtorrent::wrap_allocator_t<libtorrent::socks5_stream::handshake3<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)::{lambda(boost::system::error_code const&, unsigned long, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >, boost::system::error_code, unsigned long>&&) const (this=0x7fffee5ff8ad, f=...)
    at /usr/include/boost/asio/system_executor.hpp:322
#11 0x00007ffff0442755 in boost::asio::detail::handler_work_base<boost::asio::basic_system_executor<boost::asio::execution::detail::blocking::possibly_t<0>, boost::asio::execution::detail::relationship::fork_t<0>, std::allocator<void> >, boost::asio::any_io_executor, boost::asio::io_context, boost::asio::executor, void>::dispatch<boost::asio::detail::binder2<boost::asio::detail::read_op<libtorrent::aux::noexcept_movable<libtorrent::aux::noexcept_move_only<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor> > >, boost::asio::mutable_buffer, boost::asio::mutable_buffer const*, boost::asio::detail::transfer_all_t, libtorrent::wrap_allocator_t<libtorrent::socks5_stream::handshake3<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)::{lambda(boost::system::error_code const&, unsigned long, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >, boost::system::error_code, unsigned long>, boost::asio::detail::read_op<libtorrent::aux::noexcept_movable<libtorrent::aux::noexcept_move_only<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor> > >, boost::asio::mutable_buffer, boost::asio::mutable_buffer const*, boost::asio::detail::transfer_all_t, libtorrent::wrap_allocator_t<libtorrent::socks5_stream::handshake3<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)::{lambda(boost::system::error_code const&, unsigned long, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > > >(boost::asio::detail::binder2<boost::asio::detail::read_op<libtorrent::aux::noexcept_movable<libtorrent::aux::noexcept_move_only<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor> > >, boost::asio::mutable_buffer, boost::asio::mutable_buffer const*, boost::asio::detail::transfer_all_t, libtorrent::wrap_allocator_t<libtorrent::socks5_stream::handshake3<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)::{lambda(boost::system::error_code const&, unsigned long, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >, boost::system::error_code, unsigned long>&, boost::asio::detail::read_op<libtorrent::aux::noexcept_movable<libtorrent::aux::noexcept_move_only<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor> > >, boost::asio::mutable_buffer, boost::asio::mutable_buffer const*, boost::asio::detail::transfer_all_t, libtorrent::wrap_allocator_t<libtorrent::socks5_stream::handshake3<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)::{lambda(boost::system::error_code const&, unsigned long, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >&) (
    this=0x7fffee5ff9d8, function=..., handler=...) at /usr/include/boost/asio/detail/handler_work.hpp:92
#12 0x00007ffff043c1a5 in boost::asio::detail::handler_work<boost::asio::detail::read_op<libtorrent::aux::noexcept_movable<libtorrent::aux::noexcept_move_only<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor> > >, boost::asio::mutable_buffer, boost::asio::mutable_buffer const*, boost::asio::detail::transfer_all_t, libtorrent::wrap_allocator_t<libtorrent::socks5_stream::handshake3<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)::{lambda(boost::system::error_code const&, unsigned long, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >, boost::asio::any_io_executor, void>::complete<boost::asio::detail::binder2<boost::asio::detail::read_op<libtorrent::aux::noexcept_movable<libtorrent::aux::noexcept_move_only<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor> > >, boost::asio::mutable_buffer, boost::asio::mutable_buffer const*, boost::asio::detail::transfer_all_t, libtorrent::wrap_allocator_t<libtorrent::socks5_stream::handshake3<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)::{lambda(boost::system::error_code const&, unsigned long, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >, boost::system::error_code, unsigned long> >(boost::asio::detail::binder2<boost::asio::detail::read_op<libtorrent::aux::noexcept_movable<libtorrent::aux::noexcept_move_only<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor> > >, boost::asio::mutable_buffer, boost::asio::mutable_buffer const*, boost::asio::detail::transfer_all_t, libtorrent::wrap_allocator_t<libtorrent::socks5_stream::handshake3<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)::{lambda(boost::system::error_code const&, unsigned long, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >, boost::system::error_code, unsigned long>&, boost::asio::detail::read_op<libtorrent::aux::noexcept_movable<libtorrent::aux::noexcept_move_only<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor> > >, boost::asio::mutable_buffer, boost::asio::mutable_buffer const*, boost::asio::detail::transfer_all_t, libtorrent::wrap_allocator_t<libtorrent::socks5_stream::handshake3<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)::{lambda(boost::system::error_code const&, unsigned long, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >&) (
    this=0x7fffee5ff9a0, function=..., handler=...) at /usr/include/boost/asio/detail/handler_work.hpp:437
#13 0x00007ffff0433227 in boost::asio::detail::reactive_socket_recv_op<boost::asio::mutable_buffer, boost::asio::detail::read_op<libtorrent::aux::noexcept_movable<libtorrent::aux::noexcept_move_only<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::any_io_executor> > >, boost::asio::mutable_buffer, boost::asio::mutable_buffer const*, boost::asio::detail::transfer_all_t, libtorrent::wrap_allocator_t<libtorrent::socks5_stream::handshake3<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)::{lambda(boost::system::error_code const&, unsigned long, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >, boost::asio::any_io_executor>::do_complete(void*, boost::asio::detail::scheduler_operation*, boost::system::error_code const&, unsigned long) (
    owner=0x51100000ba80, base=0x513000046740)
    at /usr/include/boost/asio/detail/reactive_socket_recv_op.hpp:151
#14 0x00007ffff0328dc6 in boost::asio::detail::scheduler_operation::complete (this=0x513000046740, 
    owner=0x51100000ba80, ec=..., bytes_transferred=0)
    at /usr/include/boost/asio/detail/scheduler_operation.hpp:40
#15 0x00007ffff03a29a1 in boost::asio::detail::epoll_reactor::descriptor_state::do_complete (
    owner=0x51100000ba80, base=0x50f0000ac840, ec=..., bytes_transferred=5)
    at /usr/include/boost/asio/detail/impl/epoll_reactor.ipp:815
#16 0x00007ffff0328dc6 in boost::asio::detail::scheduler_operation::complete (this=0x50f0000ac840, 
    owner=0x51100000ba80, ec=..., bytes_transferred=5)
    at /usr/include/boost/asio/detail/scheduler_operation.hpp:40
#17 0x00007ffff032afe6 in boost::asio::detail::scheduler::do_run_one (this=0x51100000ba80, lock=..., 
    this_thread=..., ec=...) at /usr/include/boost/asio/detail/impl/scheduler.ipp:493
#18 0x00007ffff032acec in boost::asio::detail::scheduler::run (this=0x51100000ba80, ec=...)
    at /usr/include/boost/asio/detail/impl/scheduler.ipp:210
#19 0x00007ffff032b364 in boost::asio::io_context::run (this=0x50300006eba0)
    at /usr/include/boost/asio/impl/io_context.ipp:64
#20 0x00007ffff062608d in operator() (__closure=0x503000086928)
    at /tmp/SBo/libtorrent-2.0.11/src/session.cpp:345
#21 0x00007ffff06291ee in std::__invoke_impl<void, libtorrent::session::start(libtorrent::session_handle::session_flags_t, libtorrent::session_params&&, boost::asio::io_context*)::<lambda()> >(std::__invoke_other, struct {...} &&) (__f=...) at /usr/include/c++/14.2.0/bits/invoke.h:61
#22 0x00007ffff06291b1 in std::__invoke<libtorrent::session::start(libtorrent::session_handle::session_flags_t, libtorrent::session_params&&, boost::asio::io_context*)::<lambda()> >(struct {...} &&) (__fn=...)
    at /usr/include/c++/14.2.0/bits/invoke.h:96
#23 0x00007ffff062915e in std::thread::_Invoker<std::tuple<libtorrent::session::start(libtorrent::session_handle::session_flags_t, libtorrent::session_params&&, boost::asio::io_context*)::<lambda()> > >::_M_invoke<0>(std::_Index_tuple<0>) (this=0x503000086928) at /usr/include/c++/14.2.0/bits/std_thread.h:301
#24 0x00007ffff0629132 in std::thread::_Invoker<std::tuple<libtorrent::session::start(libtorrent::session_handle::session_flags_t, libtorrent::session_params&&, boost::asio::io_context*)::<lambda()> > >::operator()(void)
    (this=0x503000086928) at /usr/include/c++/14.2.0/bits/std_thread.h:308
#25 0x00007ffff0629116 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<libtorrent::session::start(libtorrent::session_handle::session_flags_t, libtorrent::session_params&&, boost::asio::io_context*)::<lambda()> > > >::_M_run(void) (this=0x503000086920) at /usr/include/c++/14.2.0/bits/std_thread.h:253
#26 0x00007ffff68e8f24 in ?? () from /usr/lib64/libstdc++.so.6
#27 0x00007ffff78602d6 in ?? () from /usr/lib64/libasan.so.8.0.0
#28 0x00007ffff6c9960b in start_thread () from /lib64/libc.so.6
#29 0x00007ffff6d22958 in __clone3 () from /lib64/libc.so.6

Some frames:

(gdb) frame 2
#2  0x00007ffff02e1e4b in libtorrent::assert_fail (
    expr=0x7ffff09947e8 "m_remote_endpoint.address() != address()", line=381, 
    file=0x7ffff0993020 "/tmp/SBo/libtorrent-2.0.11/include/libtorrent/socks5_stream.hpp", 
    function=0x7ffff09947bc "socks_connect", value=0x0, kind=0)
    at /tmp/SBo/libtorrent-2.0.11/src/assert.cpp:389
389             std::raise(SIGABRT);
(gdb) list
384             // SIGABRT doesn't trigger a break with msvc
385             __debugbreak();
386     #else
387             // send SIGABRT to the current process
388             // to break into the debugger
389             std::raise(SIGABRT);
390     #endif
391             std::abort();
392     #endif
393     }
(gdb) info locals
stack = "1: libtorrent::print_backtrace(char*, int, int, void*)\n2: libtorrent::assert_fail(char const*, int, char const*, char const*, char const*, int)\n3: \n4: \n5: \n6: \n7: \n8: \n9: \n10: \n11: \n12: \n13: \n14: \n15:"...
message = 0x7ffff0983630 "assertion failed. Please file a bugreport at https://github.com/arvidn/libtorrent/issues\nPlease include the following information:\n\nversion: 2.0.11.0-74bc93a37\n"
(gdb) frame 3
#3  0x00007ffff03bdf20 in libtorrent::socks5_stream::socks_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>) (this=0x51b00056e778, h=...)
    at /tmp/SBo/libtorrent-2.0.11/include/libtorrent/socks5_stream.hpp:381
381                                     TORRENT_ASSERT(m_remote_endpoint.address() != address());
(gdb) info locals
p = 0x50200004e6d3 ""
__func__ = "socks_connect"
(gdb) list
376                                     p += m_dst_name.size();
377                             }
378                             else
379                             {
380                                     // we either need a hostname or a valid endpoint
381                                     TORRENT_ASSERT(m_remote_endpoint.address() != address());
382
383                                     write_uint8(aux::is_v4(m_remote_endpoint) ? 1 : 4, p); // address type
384                                     write_address(m_remote_endpoint.address(), p);
385                             }

@autogris
Copy link
Author

Without sanitizer errors goes different and cause segfault, still appears related to socks5:

[New Thread 0x7fffebe006c0 (LWP 20795)]

Thread 2 "python3" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff1c006c0 (LWP 19996)]
0x00007ffff39a42d9 in boost::asio::detail::reactive_socket_service_base::close (this=0x7fffec037, impl=..., 
    ec=...) at /usr/include/boost/asio/detail/impl/reactive_socket_service_base.ipp:110
110         reactor_.deregister_descriptor(impl.socket_, impl.reactor_data_,
(gdb) bt
#0  0x00007ffff39a42d9 in boost::asio::detail::reactive_socket_service_base::close (this=0x7fffec037, 
    impl=..., ec=...) at /usr/include/boost/asio/detail/impl/reactive_socket_service_base.ipp:110
#1  0x00007ffff39a7e59 in boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>::close
    (this=0x7fffec00fcd0, ec=...) at /usr/include/boost/asio/basic_socket.hpp:542
#2  0x00007ffff39a56f2 in libtorrent::proxy_base::close (this=0x7fffec00fcd0, ec=...)
    at /tmp/SBo/libtorrent-2.0.11/include/libtorrent/proxy_base.hpp:237
#3  0x00007ffff39bf1d0 in libtorrent::proxy_base::handle_error<libtorrent::wrap_allocator_t<libtorrent::ssl_stream<libtorrent::socks5_stream>::async_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >(boost::system::error_code const&, libtorrent::wrap_allocator_t<libtorrent::ssl_stream<libtorrent::socks5_stream>::async_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >&&) (this=0x7fffec00fcd0, 
    e=..., h=...) at /tmp/SBo/libtorrent-2.0.11/include/libtorrent/proxy_base.hpp:288
#4  0x00007ffff39b966b in libtorrent::socks5_stream::name_lookup<libtorrent::wrap_allocator_t<libtorrent::ssl_stream<libtorrent::socks5_stream>::async_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libto--Type <RET> for more, q to quit, c to continue without paging--c
rrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >(boost::system::error_code const&, boost::asio::ip::basic_resolver_results<boost::asio::ip::tcp>, libtorrent::wrap_allocator_t<libtorrent::ssl_stream<libtorrent::socks5_stream>::async_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >) (this=0x7fffec00fcd0, e=..., ips=..., h=...)
    at /tmp/SBo/libtorrent-2.0.11/include/libtorrent/socks5_stream.hpp:187
#5  0x00007ffff39b4403 in libtorrent::socks5_stream::async_connect<libtorrent::wrap_allocator_t<libtorrent::ssl_stream<libtorrent::socks5_stream>::async_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, libtorrent::wrap_allocator_t<libtorrent::ssl_stream<libtorrent::socks5_stream>::async_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >)::{lambda(boost::system::error_code const&, boost::asio::ip::basic_resolver_results<boost::asio::ip::tcp>, libtorrent::wrap_allocator_t<libtorrent::ssl_stream<libtorrent::socks5_stream>::async_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, auto:1 const&)::{lambda(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >)#1}::operator()(boost::system::error_code const&, boost::asio::ip::basic_resolver_results<boost::asio::ip::tcp>, libtorrent::wrap_allocator_t<libtorrent::ssl_stream<libtorrent::socks5_stream>::async_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >) const (__closure=0x7ffff1bffa20, ec=..., 
    ips=..., hn=...) at /tmp/SBo/libtorrent-2.0.11/include/libtorrent/socks5_stream.hpp:176
#6  0x00007ffff3a059ae in libtorrent::wrap_allocator_t<libtorrent::socks5_stream::async_connect<libtorrent::wrap_allocator_t<libtorrent::ssl_stream<libtorrent::socks5_stream>::async_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, libtorrent::wrap_allocator_t<libtorrent::ssl_stream<libtorrent::socks5_stream>::async_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >)::{lambda(boost::system::error_code const&, boost::asio::ip::basic_resolver_results<boost::asio::ip::tcp>, libtorrent::wrap_allocator_t<libtorrent::ssl_stream<libtorrent::socks5_stream>::async_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, auto:1 const&)::{lambda(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >)#1}, libtorrent::wrap_allocator_t<libtorrent::ssl_stream<libtorrent::socks5_stream>::async_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >::operator()<boost::system::error_code const&, boost::asio::ip::basic_resolver_results<boost::asio::ip::tcp> const&>(boost::system::error_code const&, boost::asio::ip::basic_resolver_results<boost::asio::ip::tcp> const&) (
    this=0x7ffff1bffa20) at /tmp/SBo/libtorrent-2.0.11/include/libtorrent/proxy_base.hpp:316
#7  0x00007ffff39fdbbb in boost::asio::detail::binder2<libtorrent::wrap_allocator_t<libtorrent::socks5_stream::async_connect<libtorrent::wrap_allocator_t<libtorrent::ssl_stream<libtorrent::socks5_stream>::async_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, libtorrent::wrap_allocator_t<libtorrent::ssl_stream<libtorrent::socks5_stream>::async_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >)::{lambda(boost::system::error_code const&, boost::asio::ip::basic_resolver_results<boost::asio::ip::tcp>, libtorrent::wrap_allocator_t<libtorrent::ssl_stream<libtorrent::socks5_stream>::async_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, auto:1 const&)::{lambda(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >)#1}, libtorrent::wrap_allocator_t<libtorrent::ssl_stream<libtorrent::socks5_stream>::async_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >, boost::system::error_code, boost::asio::ip::basic_resolver_results<boost::asio::ip::tcp> >::operator()() (this=0x7ffff1bffa20) at /usr/include/boost/asio/detail/bind_handler.hpp:181
#8  0x00007ffff3a0cd91 in _ZNK5boost4asio21basic_system_executorINS0_9execution6detail8blocking10possibly_tILi0EEENS3_12relationship6fork_tILi0EEESaIvEE10do_executeINS0_6detail7binder2IN10libtorrent16wrap_allocator_tIZNSF_13socks5_stream13async_connectINSG_IZNSF_10ssl_streamISH_E13async_connectISt5_BindIFMNSF_15http_connectionEFvRKNS_6system10error_codeEESt10shared_ptrISN_ESt12_PlaceholderILi1EEEEEEvRKNS0_2ip14basic_endpointINS10_3tcpEEERKT_EUlSR_SZ_E_SZ_EEEEvS15_S16_EUlSR_NS10_22basic_resolver_resultsIS12_EES1A_E_S1A_EESP_S1C_EEEEvOS16_S6_ (
    this=0x7ffff1bff96d, f=...) at /usr/include/boost/asio/impl/system_executor.hpp:58
#9  0x00007ffff3a05a23 in _ZNK5boost4asio21basic_system_executorINS0_9execution6detail8blocking10possibly_tILi0EEENS3_12relationship6fork_tILi0EEESaIvEE7executeINS0_6detail7binder2IN10libtorrent16wrap_allocator_tIZNSF_13socks5_stream13async_connectINSG_IZNSF_10ssl_streamISH_E13async_connectISt5_BindIFMNSF_15http_connectionEFvRKNS_6system10error_codeEESt10shared_ptrISN_ESt12_PlaceholderILi1EEEEEEvRKNS0_2ip14basic_endpointINS10_3tcpEEERKT_EUlSR_SZ_E_SZ_EEEEvS15_S16_EUlSR_NS10_22basic_resolver_resultsIS12_EES1A_E_S1A_EESP_S1C_EEEEvOS16_ (
    this=0x7ffff1bff96d, f=...) at /usr/include/boost/asio/system_executor.hpp:322
#10 0x00007ffff39fdc25 in _ZN5boost4asio6detail17handler_work_baseINS0_21basic_system_executorINS0_9execution6detail8blocking10possibly_tILi0EEENS5_12relationship6fork_tILi0EEESaIvEEENS0_15any_io_executorENS0_10io_contextENS0_8executorEvE8dispatchINS1_7binder2IN10libtorrent16wrap_allocator_tIZNSK_13socks5_stream13async_connectINSL_IZNSK_10ssl_streamISM_E13async_connectISt5_BindIFMNSK_15http_connectionEFvRKNS_6system10error_codeEESt10shared_ptrISS_ESt12_PlaceholderILi1EEEEEEvRKNS0_2ip14basic_endpointINS15_3tcpEEERKT_EUlSW_S14_E_S14_EEEEvS1A_S1B_EUlSW_NS15_22basic_resolver_resultsIS17_EES1F_E_S1F_EESU_S1H_EES1J_EEvRS1B_RT0_ (this=0x7ffff1bffa18, 
    function=..., handler=...) at /usr/include/boost/asio/detail/handler_work.hpp:92
#11 0x00007ffff39f75df in _ZN5boost4asio6detail12handler_workIN10libtorrent16wrap_allocator_tIZNS3_13socks5_stream13async_connectINS4_IZNS3_10ssl_streamIS5_E13async_connectISt5_BindIFMNS3_15http_connectionEFvRKNS_6system10error_codeEESt10shared_ptrISB_ESt12_PlaceholderILi1EEEEEEvRKNS0_2ip14basic_endpointINSO_3tcpEEERKT_EUlSF_SN_E_SN_EEEEvST_SU_EUlSF_NSO_22basic_resolver_resultsISQ_EESY_E_SY_EENS0_15any_io_executorEvE8completeINS1_7binder2IS12_SD_S10_EEEEvRSU_RS12_ (this=0x7ffff1bff9e0, function=..., handler=...)
    at /usr/include/boost/asio/detail/handler_work.hpp:437
#12 0x00007ffff39f038a in boost::asio::detail::resolve_query_op<boost::asio::ip::tcp, libtorrent::wrap_allocator_t<libtorrent::socks5_stream::async_connect<libtorrent::wrap_allocator_t<libtorrent::ssl_stream<libtorrent::socks5_stream>::async_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, libtorrent::wrap_allocator_t<libtorrent::ssl_stream<libtorrent::socks5_stream>::async_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >)::{lambda(boost::system::error_code const&, boost::asio::ip::basic_resolver_results<boost::asio::ip::tcp>, libtorrent::wrap_allocator_t<libtorrent::ssl_stream<libtorrent::socks5_stream>::async_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, auto:1 const&)::{lambda(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >)#1}, libtorrent::wrap_allocator_t<libtorrent::ssl_stream<libtorrent::socks5_stream>::async_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >, boost::asio::any_io_executor>::do_complete(void*, boost::asio::detail::scheduler_operation*, boost::system::error_code const&, unsigned long) (owner=0xc49830, 
    base=0x7fffed3e2720) at /usr/include/boost/asio/detail/resolve_query_op.hpp:131
#13 0x00007ffff3928dc6 in boost::asio::detail::scheduler_operation::complete (this=0x7fffed3e2720, 
    owner=0xc49830, ec=..., bytes_transferred=0) at /usr/include/boost/asio/detail/scheduler_operation.hpp:40
#14 0x00007ffff392afe6 in boost::asio::detail::scheduler::do_run_one (this=0xc49830, lock=..., 
    this_thread=..., ec=...) at /usr/include/boost/asio/detail/impl/scheduler.ipp:493
#15 0x00007ffff392acec in boost::asio::detail::scheduler::run (this=0xc49830, ec=...)
    at /usr/include/boost/asio/detail/impl/scheduler.ipp:210
#16 0x00007ffff392b364 in boost::asio::io_context::run (this=0xed6140)
    at /usr/include/boost/asio/impl/io_context.ipp:64
#17 0x00007ffff3c2608d in operator() (__closure=0x111b378) at /tmp/SBo/libtorrent-2.0.11/src/session.cpp:345
#18 0x00007ffff3c291ee in std::__invoke_impl<void, libtorrent::session::start(libtorrent::session_handle::session_flags_t, libtorrent::session_params&&, boost::asio::io_context*)::<lambda()> >(std::__invoke_other, struct {...} &&) (__f=...) at /usr/include/c++/14.2.0/bits/invoke.h:61
#19 0x00007ffff3c291b1 in std::__invoke<libtorrent::session::start(libtorrent::session_handle::session_flags_t, libtorrent::session_params&&, boost::asio::io_context*)::<lambda()> >(struct {...} &&) (__fn=...)
    at /usr/include/c++/14.2.0/bits/invoke.h:96
#20 0x00007ffff3c2915e in std::thread::_Invoker<std::tuple<libtorrent::session::start(libtorrent::session_handle::session_flags_t, libtorrent::session_params&&, boost::asio::io_context*)::<lambda()> > >::_M_invoke<0>(std::_Index_tuple<0>) (this=0x111b378) at /usr/include/c++/14.2.0/bits/std_thread.h:301
#21 0x00007ffff3c29132 in std::thread::_Invoker<std::tuple<libtorrent::session::start(libtorrent::session_handle::session_flags_t, libtorrent::session_params&&, boost::asio::io_context*)::<lambda()> > >::operator()(void)
    (this=0x111b378) at /usr/include/c++/14.2.0/bits/std_thread.h:308
#22 0x00007ffff3c29116 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<libtorrent::session::start(libtorrent::session_handle::session_flags_t, libtorrent::session_params&&, boost::asio::io_context*)::<lambda()> > > >::_M_run(void) (this=0x111b370) at /usr/include/c++/14.2.0/bits/std_thread.h:253
#23 0x00007ffff34e8f24 in ?? () from /usr/lib64/libstdc++.so.6
#24 0x00007ffff749960b in start_thread () from /lib64/libc.so.6
#25 0x00007ffff7522958 in __clone3 () from /lib64/libc.so.6

Some frames:

(gdb) frame 0
#0  0x00007ffff39a42d9 in boost::asio::detail::reactive_socket_service_base::close (this=0x7fffec037, 
    impl=..., ec=...) at /usr/include/boost/asio/detail/impl/reactive_socket_service_base.ipp:110
110         reactor_.deregister_descriptor(impl.socket_, impl.reactor_data_,
(gdb) list
105       if (is_open(impl))
106       {
107         BOOST_ASIO_HANDLER_OPERATION((reactor_.context(),
108               "socket", &impl, impl.socket_, "close"));
109
110         reactor_.deregister_descriptor(impl.socket_, impl.reactor_data_,
111             (impl.state_ & socket_ops::possible_dup) == 0);
112
113         socket_ops::close(impl.socket_, impl.state_, false, ec);
114
(gdb) info locals
No locals.
(gdb) frame 1
#1  0x00007ffff39a7e59 in boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::any_io_executor>::close
    (this=0x7fffec00fcd0, ec=...) at /usr/include/boost/asio/basic_socket.hpp:542
542         impl_.get_service().close(impl_.get_implementation(), ec);
(gdb) list
537        * @note For portable behaviour with respect to graceful closure of a
538        * connected socket, call shutdown() before closing the socket.
539        */
540       BOOST_ASIO_SYNC_OP_VOID close(boost::system::error_code& ec)
541       {
542         impl_.get_service().close(impl_.get_implementation(), ec);
543         BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
544       }
545
546       /// Release ownership of the underlying native socket.
(gdb) info locals
No locals.
(gdb) frame 2
#2  0x00007ffff39a56f2 in libtorrent::proxy_base::close (this=0x7fffec00fcd0, ec=...)
    at /tmp/SBo/libtorrent-2.0.11/include/libtorrent/proxy_base.hpp:237
237                     m_sock.close(ec);
(gdb) list
232     #endif
233
234             void close(error_code& ec)
235             {
236                     m_remote_endpoint = endpoint_type();
237                     m_sock.close(ec);
238                     m_resolver.cancel();
239             }
240
241     #ifndef BOOST_NO_EXCEPTIONS
(gdb) info locals
No locals.
(gdb) frame 3
#3  0x00007ffff39bf1d0 in libtorrent::proxy_base::handle_error<libtorrent::wrap_allocator_t<libtorrent::ssl_stream<libtorrent::socks5_stream>::async_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >(boost::system::error_code const&, libtorrent::wrap_allocator_t<libtorrent::ssl_stream<libtorrent::socks5_stream>::async_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >&&) (this=0x7fffec00fcd0, 
    e=..., h=...) at /tmp/SBo/libtorrent-2.0.11/include/libtorrent/proxy_base.hpp:288
288                     close(ec);
(gdb) info locals
ec = {{d1_ = {val_ = 0, cat_ = 0x0}, d2_ = "\000\000\000\000\377\177\000\000\000\000\000\000\000\000\000"}, 
  lc_flags_ = 0}
(gdb) list
283             bool handle_error(error_code const& e, Handler&& h)
284             {
285                     if (!e) return false;
286                     std::forward<Handler>(h)(e);
287                     error_code ec;
288                     close(ec);
289                     return true;
290             }
291
292             aux::noexcept_movable<tcp::socket> m_sock;
(gdb) frame 4
#4  0x00007ffff39b966b in libtorrent::socks5_stream::name_lookup<libtorrent::wrap_allocator_t<libtorrent::ssl_stream<libtorrent::socks5_stream>::async_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> > >(boost::system::error_code const&, boost::asio::ip::basic_resolver_results<boost::asio::ip::tcp>, libtorrent::wrap_allocator_t<libtorrent::ssl_stream<libtorrent::socks5_stream>::async_connect<std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> const&)::{lambda(boost::system::error_code const&, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)>)#1}, std::_Bind<void (libtorrent::http_connection::*(std::shared_ptr<libtorrent::http_connection>, std::_Placeholder<1>))(boost::system::error_code const&)> >) (this=0x7fffec00fcd0, e=..., ips=..., h=...)
    at /tmp/SBo/libtorrent-2.0.11/include/libtorrent/socks5_stream.hpp:187
187                     if (handle_error(e, std::move(h))) return;
(gdb) list
182             template <typename Handler>
183             void name_lookup(error_code const& e, tcp::resolver::results_type ips
184                     , Handler h)
185             {
186                     COMPLETE_ASYNC("socks5_stream::name_lookup");
187                     if (handle_error(e, std::move(h))) return;
188
189                     auto i = ips.begin();
190                     if (!m_sock.is_open())
191                     {
(gdb) info locals
i = {
  values_ = std::shared_ptr<std::vector<boost::asio::ip::basic_resolver_entry<boost::asio::ip::tcp>, std::allocator<boost::asio::ip::basic_resolver_entry<boost::asio::ip::tcp> > >> (use count -443987883, weak count -326940590) = {get() = 0x7ffff1bff6e0}, index_ = 140737249278040}

@arvidn
Copy link
Owner

arvidn commented Nov 9, 2024

it's not so easy to figure out what's going on unfortunately. Maybe the whole socket object is destructed but then still had an async operation issued. That might explain the asio address sanitizer issue. The assert is likely an earlier symptom of the same problem. It's not obvious how that can happen either, unless the socket is closed (and m_remote_endpoint is cleared) while the handler for handshake3 is already in the io_service's queue. Once it's called, the socket object is in an unexpected state.

@arvidn
Copy link
Owner

arvidn commented Nov 9, 2024

perhaps, when the assert fires, m_sock.is_closed() is true. I'll make a PR to check for this.

@arvidn
Copy link
Owner

arvidn commented Nov 9, 2024

#7785

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants