johang/btfs

btfs 2.11 crash

rnhmjoj opened this issue · 5 comments

Since version 2.11 btfs is crashing immediately after mounting a torrent.

$ mkdir ~/torrent
$ btfs magnet:?xt=urn:btih:84b1be796023afa4381d8a9f7447fc440b0eb0d5 ~/torrent
$ ls ~/torrent
ls: cannot access '/home/rnhmjoj/torrent': Transport endpoint is not connected

I have tried this on a couple of different systems and it's consistent. Is there a log or something to debug it?

What happens if you run in foreground (btfs -f ...)?

It's a segfault. btfs doesn't print anything at all.

I have the same problem, I've rebuilt btfs and libtorrent rasterbar with debug symbols and got a stacktrace, at glance the problem seems to be in libtorrent, howrever, considering that it's btfs that changed, perhaps it's passing corrupted data to the lib?

Using host libthread_db library "/usr/lib/libthread_db.so.1".
FUSE library version: 2.9.7
nullpath_ok: 0
nopath: 0
utime_omit_ok: 0
[New Thread 0x7ffff3dc2700 (LWP 9980)]
[New Thread 0x7ffff35c1700 (LWP 9981)]
unique: 1, opcode: INIT (26), nodeid: 0, insize: 56, pid: 0
INIT: 7.25
flags=0x0007fffb
max_readahead=0x00020000
[New Thread 0x7ffff2dc0700 (LWP 9982)]
[New Thread 0x7ffff25bf700 (LWP 9983)]
[New Thread 0x7ffff1dbe700 (LWP 9984)]
[New Thread 0x7ffff15bd700 (LWP 9985)]
[New Thread 0x7ffff0dbc700 (LWP 9986)]
[New Thread 0x7fffebfff700 (LWP 9987)]
[New Thread 0x7fffeb7fe700 (LWP 9988)]

Thread 10 "btfs" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffeb7fe700 (LWP 9988)]
-----------------------------------------------------------------------------------------------------------------------[regs]
  RAX: 0x00007FFFEB7FDC20  RBX: 0x0000000000000000  RBP: 0x0000000000000000  RSP: 0x00007FFFEB7FDBA8  o d I t s z a p c 
  RDI: 0x0000000000000000  RSI: 0x000000003B9ACA00  RDX: 0x0000000000000000  RCX: 0x0000000000000000  RIP: 0x00007FFFF7771C10
  R8 : 0x00007FFFEB7FE700  R9 : 0x00007FFFEB7FE700  R10: 0x000000000000071A  R11: 0x00007FFFF7771C10  R12: 0x0000000000000000
  R13: 0x00007FFFF3DC185F  R14: 0x00007FFFEC0081F0  R15: 0x00007FFFF7FFD000
  CS: 0033  DS: 0000  ES: 0000  FS: 0000  GS: 0000  SS: 002B                
-----------------------------------------------------------------------------------------------------------------------[code]
=> 0x7ffff7771c10 <_ZN10libtorrent14session_handle14wait_for_alertENSt6chrono8durationIlSt5ratioILl1ELl1000000000EEEE>: mov    rdi,QWORD PTR [rdi]
   0x7ffff7771c13 <_ZN10libtorrent14session_handle14wait_for_alertENSt6chrono8durationIlSt5ratioILl1ELl1000000000EEEE+3>:   jmp    0x7ffff779bdb0 <_ZN10libtorrent3aux12session_impl14wait_for_alertENSt6chrono8durationIlSt5ratioILl1ELl1000000000EEEE>
   0x7ffff7771c18:  nop    DWORD PTR [rax+rax*1+0x0]
   0x7ffff7771c20 <_ZN10libtorrent14session_handle16set_alert_notifyERKN5boost8functionIFvvEEE>:    mov    rdi,QWORD PTR [rdi]
   0x7ffff7771c23 <_ZN10libtorrent14session_handle16set_alert_notifyERKN5boost8functionIFvvEEE+3>:  add    rdi,0xf78
   0x7ffff7771c2a <_ZN10libtorrent14session_handle16set_alert_notifyERKN5boost8functionIFvvEEE+10>: jmp    0x7ffff7634880 <_ZN10libtorrent13alert_manager19set_notify_functionERKN5boost8functionIFvvEEE>
   0x7ffff7771c2f:  nop
   0x7ffff7771c30 <_ZN10libtorrent14session_handle18set_alert_dispatchERKN5boost8functionIFvSt8auto_ptrINS_5alertEEEEE>:    mov    rdi,QWORD PTR [rdi]
-----------------------------------------------------------------------------------------------------------------------------
0x00007ffff7771c10 in libtorrent::session_handle::wait_for_alert(std::chrono::duration<long, std::ratio<1l, 1000000000l> >) () from /usr/lib/libtorrent-rasterbar.so.9
gdb$ thread apply all bt

Thread 10 (Thread 0x7fffeb7fe700 (LWP 9988)):
#0  0x00007ffff7771c10 in libtorrent::session_handle::wait_for_alert(std::chrono::duration<long, std::ratio<1l, 1000000000l> >) () from /usr/lib/libtorrent-rasterbar.so.9
#1  0x000055555555dfc1 in alert_queue_loop (data=0x7fffec0081f0) at btfs.cc:368
#2  0x00007ffff6f14454 in start_thread () from /usr/lib/libpthread.so.0
#3  0x00007ffff66b87df in clone () from /usr/lib/libc.so.6

Thread 9 (Thread 0x7fffebfff700 (LWP 9987)):
#0  0x00007ffff7de9ca0 in _dl_debug_state () from /lib64/ld-linux-x86-64.so.2
#1  0x00007ffff7ded8c6 in dl_open_worker () from /lib64/ld-linux-x86-64.so.2
#2  0x00007ffff7de93a4 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2
#3  0x00007ffff7ded2d9 in _dl_open () from /lib64/ld-linux-x86-64.so.2
#4  0x00007ffff66eea7d in do_dlopen () from /usr/lib/libc.so.6
#5  0x00007ffff7de93a4 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2
#6  0x00007ffff66eeb0f in dlerror_run () from /usr/lib/libc.so.6
#7  0x00007ffff66eeb82 in __libc_dlopen_mode () from /usr/lib/libc.so.6
#8  0x00007ffff66d7d50 in nss_load_library () from /usr/lib/libc.so.6
#9  0x00007ffff66d8538 in __nss_lookup_function () from /usr/lib/libc.so.6
#10 0x00007ffff66a3df8 in gaih_inet.constprop () from /usr/lib/libc.so.6
#11 0x00007ffff66a5178 in getaddrinfo () from /usr/lib/libc.so.6
#12 0x00007ffff7760988 in boost::asio::detail::resolve_op<boost::asio::ip::tcp, boost::_bi::bind_t<void, boost::_mfi::mf4<void, libtorrent::resolver, boost::system::error_code const&, boost::asio::ip::basic_resolver_iterator<boost::asio::ip::tcp>, boost::function<void (boost::system::error_code const&, std::vector<boost::asio::ip::address, std::allocator<boost::asio::ip::address> > const&)>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::_bi::list5<boost::_bi::value<libtorrent::resolver*>, boost::arg<1>, boost::arg<2>, boost::_bi::value<boost::function<void (boost::system::error_code const&, std::vector<boost::asio::ip::address, std::allocator<boost::asio::ip::address> > const&)> >, boost::_bi::value<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >::do_complete(boost::asio::detail::task_io_service*, boost::asio::detail::task_io_service_operation*, boost::system::error_code const&, unsigned long) () from /usr/lib/libtorrent-rasterbar.so.9
#13 0x00007ffff76911b8 in boost::asio::detail::posix_thread::func<boost::asio::detail::resolver_service_base::work_io_service_runner>::run() () from /usr/lib/libtorrent-rasterbar.so.9
#14 0x00007ffff766f71e in boost_asio_detail_posix_thread_function () from /usr/lib/libtorrent-rasterbar.so.9
#15 0x00007ffff6f14454 in start_thread () from /usr/lib/libpthread.so.0
#16 0x00007ffff66b87df in clone () from /usr/lib/libc.so.6

Thread 8 (Thread 0x7ffff0dbc700 (LWP 9986)):
#0  0x00007ffff6f1a10f in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#1  0x00007ffff766ef43 in libtorrent::disk_io_thread::thread_fun(int, libtorrent::disk_io_thread::thread_type_t, boost::shared_ptr<boost::asio::io_service::work>) () from /usr/lib/libtorrent-rasterbar.so.9
#2  0x00007ffff766fe28 in boost::asio::detail::posix_thread::func<boost::_bi::bind_t<void, boost::_mfi::mf3<void, libtorrent::disk_io_thread, int, libtorrent::disk_io_thread::thread_type_t, boost::shared_ptr<boost::asio::io_service::work> >, boost::_bi::list4<boost::_bi::value<libtorrent::disk_io_thread*>, boost::_bi::value<int>, boost::_bi::value<libtorrent::disk_io_thread::thread_type_t>, boost::_bi::value<boost::shared_ptr<boost::asio::io_service::work> > > > >::run() () from /usr/lib/libtorrent-rasterbar.so.9
#3  0x00007ffff766f71e in boost_asio_detail_posix_thread_function () from /usr/lib/libtorrent-rasterbar.so.9
#4  0x00007ffff6f14454 in start_thread () from /usr/lib/libpthread.so.0
#5  0x00007ffff66b87df in clone () from /usr/lib/libc.so.6

Thread 7 (Thread 0x7ffff15bd700 (LWP 9985)):
#0  0x00007ffff6f1a10f in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#1  0x00007ffff766ee3a in libtorrent::disk_io_thread::thread_fun(int, libtorrent::disk_io_thread::thread_type_t, boost::shared_ptr<boost::asio::io_service::work>) () from /usr/lib/libtorrent-rasterbar.so.9
#2  0x00007ffff766fe28 in boost::asio::detail::posix_thread::func<boost::_bi::bind_t<void, boost::_mfi::mf3<void, libtorrent::disk_io_thread, int, libtorrent::disk_io_thread::thread_type_t, boost::shared_ptr<boost::asio::io_service::work> >, boost::_bi::list4<boost::_bi::value<libtorrent::disk_io_thread*>, boost::_bi::value<int>, boost::_bi::value<libtorrent::disk_io_thread::thread_type_t>, boost::_bi::value<boost::shared_ptr<boost::asio::io_service::work> > > > >::run() () from /usr/lib/libtorrent-rasterbar.so.9
#3  0x00007ffff766f71e in boost_asio_detail_posix_thread_function () from /usr/lib/libtorrent-rasterbar.so.9
#4  0x00007ffff6f14454 in start_thread () from /usr/lib/libpthread.so.0
#5  0x00007ffff66b87df in clone () from /usr/lib/libc.so.6

Thread 6 (Thread 0x7ffff1dbe700 (LWP 9984)):
#0  0x00007ffff6f1a10f in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#1  0x00007ffff766ee3a in libtorrent::disk_io_thread::thread_fun(int, libtorrent::disk_io_thread::thread_type_t, boost::shared_ptr<boost::asio::io_service::work>) () from /usr/lib/libtorrent-rasterbar.so.9
#2  0x00007ffff766fe28 in boost::asio::detail::posix_thread::func<boost::_bi::bind_t<void, boost::_mfi::mf3<void, libtorrent::disk_io_thread, int, libtorrent::disk_io_thread::thread_type_t, boost::shared_ptr<boost::asio::io_service::work> >, boost::_bi::list4<boost::_bi::value<libtorrent::disk_io_thread*>, boost::_bi::value<int>, boost::_bi::value<libtorrent::disk_io_thread::thread_type_t>, boost::_bi::value<boost::shared_ptr<boost::asio::io_service::work> > > > >::run() () from /usr/lib/libtorrent-rasterbar.so.9
#3  0x00007ffff766f71e in boost_asio_detail_posix_thread_function () from /usr/lib/libtorrent-rasterbar.so.9
#4  0x00007ffff6f14454 in start_thread () from /usr/lib/libpthread.so.0
#5  0x00007ffff66b87df in clone () from /usr/lib/libc.so.6

Thread 5 (Thread 0x7ffff25bf700 (LWP 9983)):
#0  0x00007ffff6f1a10f in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#1  0x00007ffff766ee3a in libtorrent::disk_io_thread::thread_fun(int, libtorrent::disk_io_thread::thread_type_t, boost::shared_ptr<boost::asio::io_service::work>) () from /usr/lib/libtorrent-rasterbar.so.9
#2  0x00007ffff766fe28 in boost::asio::detail::posix_thread::func<boost::_bi::bind_t<void, boost::_mfi::mf3<void, libtorrent::disk_io_thread, int, libtorrent::disk_io_thread::thread_type_t, boost::shared_ptr<boost::asio::io_service::work> >, boost::_bi::list4<boost::_bi::value<libtorrent::disk_io_thread*>, boost::_bi::value<int>, boost::_bi::value<libtorrent::disk_io_thread::thread_type_t>, boost::_bi::value<boost::shared_ptr<boost::asio::io_service::work> > > > >::run() () from /usr/lib/libtorrent-rasterbar.so.9
#3  0x00007ffff766f71e in boost_asio_detail_posix_thread_function () from /usr/lib/libtorrent-rasterbar.so.9
#4  0x00007ffff6f14454 in start_thread () from /usr/lib/libpthread.so.0
#5  0x00007ffff66b87df in clone () from /usr/lib/libc.so.6

Thread 4 (Thread 0x7ffff2dc0700 (LWP 9982)):
#0  0x00007ffff664fe2e in __strcmp_sse2 () from /usr/lib/libc.so.6
#1  0x00007ffff65f16a8 in find_derivation () from /usr/lib/libc.so.6
#2  0x00007ffff65f20b1 in __gconv_find_transform () from /usr/lib/libc.so.6
#3  0x00007ffff65f0c29 in __gconv_open () from /usr/lib/libc.so.6
#4  0x00007ffff65f075c in iconv_open () from /usr/lib/libc.so.6
#5  0x00007ffff7679e03 in libtorrent::convert_from_native(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /usr/lib/libtorrent-rasterbar.so.9
#6  0x00007ffff76f6af8 in libtorrent::natpmp::on_reply(boost::system::error_code const&, unsigned long) () from /usr/lib/libtorrent-rasterbar.so.9
#7  0x00007ffff76f86ca in boost::asio::detail::reactive_socket_recvfrom_op<boost::asio::mutable_buffers_1, boost::asio::ip::basic_endpoint<boost::asio::ip::udp>, boost::_bi::bind_t<void, boost::_mfi::mf2<void, libtorrent::natpmp, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptr<libtorrent::natpmp> >, boost::arg<1>, boost::arg<2> > > >::do_complete(boost::asio::detail::task_io_service*, boost::asio::detail::task_io_service_operation*, boost::system::error_code const&, unsigned long) () from /usr/lib/libtorrent-rasterbar.so.9
#8  0x00007ffff776ee98 in boost::asio::io_service::run() () from /usr/lib/libtorrent-rasterbar.so.9
#9  0x00007ffff766f71e in boost_asio_detail_posix_thread_function () from /usr/lib/libtorrent-rasterbar.so.9
#10 0x00007ffff6f14454 in start_thread () from /usr/lib/libpthread.so.0
#11 0x00007ffff66b87df in clone () from /usr/lib/libc.so.6

Thread 3 (Thread 0x7ffff35c1700 (LWP 9981)):
#0  0x00007ffff6f1d1cd in read () from /usr/lib/libpthread.so.0
#1  0x00007ffff7baf0c2 in ?? () from /usr/lib/libfuse.so.2
#2  0x00007ffff7bb0c39 in ?? () from /usr/lib/libfuse.so.2
#3  0x00007ffff7baf6ee in ?? () from /usr/lib/libfuse.so.2
#4  0x00007ffff6f14454 in start_thread () from /usr/lib/libpthread.so.0
#5  0x00007ffff66b87df in clone () from /usr/lib/libc.so.6

Thread 2 (Thread 0x7ffff3dc2700 (LWP 9980)):
#0  0x00007ffff6f1568d in pthread_join () from /usr/lib/libpthread.so.0
#1  0x00007ffff776e351 in libtorrent::session::~session() () from /usr/lib/libtorrent-rasterbar.so.9
#2  0x000055555555ba77 in btfs_init (conn=<optimized out>) at btfs.cc:587
#3  0x00007ffff7bad9fb in fuse_fs_init () from /usr/lib/libfuse.so.2
#4  0x00007ffff7bb1d8c in ?? () from /usr/lib/libfuse.so.2
#5  0x00007ffff7bb2fc1 in ?? () from /usr/lib/libfuse.so.2
#6  0x00007ffff7baf768 in ?? () from /usr/lib/libfuse.so.2
#7  0x00007ffff6f14454 in start_thread () from /usr/lib/libpthread.so.0
#8  0x00007ffff66b87df in clone () from /usr/lib/libc.so.6

Thread 1 (Thread 0x7ffff7f58780 (LWP 9977)):
#0  0x00007ffff6f1c4f7 in do_futex_wait.constprop () from /usr/lib/libpthread.so.0
#1  0x00007ffff6f1c5a4 in __new_sem_wait_slow.constprop.0 () from /usr/lib/libpthread.so.0
#2  0x00007ffff7baf958 in fuse_session_loop_mt () from /usr/lib/libfuse.so.2
#3  0x00007ffff7bb5077 in fuse_loop_mt () from /usr/lib/libfuse.so.2
#4  0x00007ffff7bb7d7d in ?? () from /usr/lib/libfuse.so.2
#5  0x000055555555a153 in main (argc=<optimized out>, argv=<optimized out>) at btfs.cc:878

What versions of everything are you running (btfs -v)?

btfs version: 2.11
FUSE library version: 2.9.7
fusermount version: 2.9.7
using FUSE kernel interface version 7.19

according to distro package, libtorrent is at 1:1.1