xlgjjff / libtorrent

Automatically exported from code.google.com/p/libtorrent
Other
0 stars 0 forks source link

qbittorrent hanged at exit #705

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
qbittorrent hanged at exit. I have been waiting for several minutes and it 
still hangs.

Linux Ubuntu 14.04 64-bit. libtorrent 1.0.x r10529. Boost 1.54.

(gdb) thread apply all bt

Thread 9 (Thread 0x7f279ec76700 (LWP 1315)):
#0  0x00007f27a23bfc33 in select () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007f27a3c80171 in QProcessManager::run (this=0x7f27a400a540 
<processManager()::processManager>) at io/qprocess_unix.cpp:270
#2  0x00007f27a3ba132f in QThreadPrivate::start (arg=0x7f27a400a540 
<processManager()::processManager>) at thread/qthread_unix.cpp:349
#3  0x00007f27a54deb98 in ?? () from /usr/lib/x86_64-linux-gnu/libasan.so.0
#4  0x00007f27a2ebb182 in start_thread (arg=0x7f279ec76700) at 
pthread_create.c:312
#5  0x00007f27a23c830d in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 8 (Thread 0x7f27918a2700 (LWP 1318)):
#0  0x00007f27a23c89a3 in epoll_wait () at ../sysdeps/unix/syscall-template.S:81
#1  0x0000000000875bc0 in boost::asio::detail::epoll_reactor::run 
(this=0x601e00045820, block=<optimized out>, ops=...)
    at /usr/include/boost/asio/detail/impl/epoll_reactor.ipp:392
#2  0x0000000000877e5a in boost::asio::detail::task_io_service::do_run_one 
(this=this@entry=0x601c000aa960, lock=..., this_thread=..., ec=...)
    at /usr/include/boost/asio/detail/impl/task_io_service.ipp:368
#3  0x000000000088a54c in boost::asio::detail::task_io_service::run 
(this=0x601c000aa960, ec=...) at 
/usr/include/boost/asio/detail/impl/task_io_service.ipp:153
#4  0x000000000088a9e3 in boost::asio::io_service::run 
(this=this@entry=0x6072001ead40, ec=...) at 
/usr/include/boost/asio/impl/io_service.ipp:66
#5  0x00000000009ab8d4 in libtorrent::aux::session_impl::main_thread 
(this=0x6072001ea900) at session_impl.cpp:4886
#6  0x00000000009c2f6c in operator() (p=<optimized out>, this=<optimized out>) 
at /usr/include/boost/bind/mem_fn_template.hpp:49
#7  operator()<boost::_mfi::mf0<void, libtorrent::aux::session_impl>, 
boost::_bi::list0> (a=<synthetic pointer>, f=..., this=<optimized out>)
    at /usr/include/boost/bind/bind.hpp:253
#8  operator() (this=<optimized out>) at 
/usr/include/boost/bind/bind_template.hpp:20
#9  boost::asio::detail::posix_thread::func<boost::_bi::bind_t<void, 
boost::_mfi::mf0<void, libtorrent::aux::session_impl>, 
boost::_bi::list1<boost::_bi::value<libtorrent::aux::session_impl*> > > >::run 
(this=<optimized out>) at /usr/include/boost/asio/detail/posix_thread.hpp:82
#10 0x0000000000868ea4 in 
boost::asio::detail::boost_asio_detail_posix_thread_function 
(arg=0x6006000fe2f0) at /usr/include/boost/asio/detail/impl/posix_thread.ipp:64
#11 0x00007f27a54deb98 in ?? () from /usr/lib/x86_64-linux-gnu/libasan.so.0
#12 0x00007f27a2ebb182 in start_thread (arg=0x7f27918a2700) at 
pthread_create.c:312
#13 0x00007f27a23c830d in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 7 (Thread 0x7f2790d9b700 (LWP 1319)):
#0  0x00007f27a23bafbd in poll () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007f27901591e3 in send_dg (resplen2=0x7f2790d99e30, 
anssizp2=0x7f2790d99e20, ansp2=0x7f2790d99e60, anscp=0x7f2790d99e50, 
gotsomewhere=<synthetic pointer>, 
    v_circuit=<synthetic pointer>, ns=1, terrno=0x7f2790d988a0, anssizp=0x7f2790d989e0, ansp=0x7f2790d98898, buflen2=44, buf2=0x7f2790d98a3c "\334\366\001", buflen=44, 
    buf=0x7f2790d98a10 ":\331\001", statp=0x7f2790d9bdb8) at res_send.c:1067
#2  __libc_res_nsend (statp=statp@entry=0x7f2790d9bdb8, 
buf=buf@entry=0x7f2790d98a10 ":\331\001", buflen=44, 
buf2=buf2@entry=0x7f2790d98a3c "\334\366\001", 
    buflen2=buflen2@entry=44, ans=ans@entry=0x7f2790d995f0 "\334", <incomplete sequence \366\201\202>, anssiz=anssiz@entry=2048, ansp=ansp@entry=0x7f2790d99e50, 
    ansp2=ansp2@entry=0x7f2790d99e60, nansp2=nansp2@entry=0x7f2790d99e20, resplen2=resplen2@entry=0x7f2790d99e30) at res_send.c:556
#3  0x00007f2790156e05 in __GI___libc_res_nquery 
(statp=statp@entry=0x7f2790d9bdb8, name=0x600c00edecd8 
"tracker.openbittorrent.com", class=class@entry=1, type=type@entry=62321, 
    answer=answer@entry=0x7f2790d995f0 "\334", <incomplete sequence \366\201\202>, anslen=anslen@entry=2048, answerp=answerp@entry=0x7f2790d99e50, 
    answerp2=answerp2@entry=0x7f2790d99e60, nanswerp2=nanswerp2@entry=0x7f2790d99e20, resplen2=resplen2@entry=0x7f2790d99e30) at res_query.c:226
#4  0x00007f27901577f9 in __libc_res_nquerydomain (domain=0x0, 
resplen2=0x7f2790d99e30, nanswerp2=0x7f2790d99e20, answerp2=0x7f2790d99e60, 
answerp=0x7f2790d99e50, anslen=2048, 
    answer=0x7f2790d995f0 "\334", <incomplete sequence \366\201\202>, type=62321, class=1, name=0x600c00edecd8 "tracker.openbittorrent.com", statp=0x7f2790d9bdb8)
    at res_query.c:582
#5  __GI___libc_res_nsearch (statp=0x7f2790d9bdb8, 
name=name@entry=0x600c00edecd8 "tracker.openbittorrent.com", 
class=class@entry=1, type=type@entry=62321, 
    answer=answer@entry=0x7f2790d995f0 "\334", <incomplete sequence \366\201\202>, anslen=anslen@entry=2048, answerp=answerp@entry=0x7f2790d99e50, 
    answerp2=answerp2@entry=0x7f2790d99e60, nanswerp2=nanswerp2@entry=0x7f2790d99e20, resplen2=resplen2@entry=0x7f2790d99e30) at res_query.c:378
#6  0x00007f279036bc2d in _nss_dns_gethostbyname4_r 
(name=name@entry=0x600c00edecd8 "tracker.openbittorrent.com", 
pat=pat@entry=0x7f2790d9a4a0, 
    buffer=buffer@entry=0x7f2790d99f00 "\377\002", buflen=buflen@entry=1064, errnop=errnop@entry=0x7f2790d9a470, herrnop=herrnop@entry=0x7f2790d9a4c0, ttlp=ttlp@entry=0x0)
    at nss_dns/dns-host.c:314
#7  0x00007f27a239a597 in gaih_inet (name=<optimized out>, 
name@entry=0x600c00edecd8 "tracker.openbittorrent.com", service=<optimized 
out>, req=req@entry=0x601e000cbd08, 
    pai=pai@entry=0x7f2790d9a5d0, naddrs=naddrs@entry=0x7f2790d9a5c0) at ../sysdeps/posix/getaddrinfo.c:850
#8  0x00007f27a239dc4d in __GI_getaddrinfo (name=0x600c00edecd8 
"tracker.openbittorrent.com", service=0x600600d13698 "80", 
hints=0x601e000cbd08, pai=0x601e000cbd78)
    at ../sysdeps/posix/getaddrinfo.c:2406
#9  0x0000000000870f31 in boost::asio::detail::socket_ops::getaddrinfo 
(host=0x600c00edecd8 "tracker.openbittorrent.com", service=0x600600d13698 "80", 
hints=..., 
    result=0x601e000cbd78, ec=...) at /usr/include/boost/asio/detail/impl/socket_ops.ipp:2945
#10 0x00000000008713fd in 
boost::asio::detail::socket_ops::background_getaddrinfo (cancel_token=..., 
host=<optimized out>, service=service@entry=0x600600d13698 "80", hints=..., 
    result=result@entry=0x601e000cbd78, ec=...) at /usr/include/boost/asio/detail/impl/socket_ops.ipp:2958
#11 0x0000000000c24de6 in boost::asio::detail::resolve_op<boost::asio::ip::tcp, 
boost::_bi::bind_t<void, boost::_mfi::mf2<void, 
libtorrent::udp_tracker_connection, boost::system::error_code const&, 
boost::asio::ip::basic_resolver_iterator<boost::asio::ip::tcp> >, 
boost::_bi::list3<boost::_bi::value<boost::intrusive_ptr<libtorrent::udp_tracker
_connection> >, boost::arg<1>, boost::arg<2> > > >::do_complete 
(owner=<optimized out>, base=0x601e000cbce0) at 
/usr/include/boost/asio/detail/resolve_op.hpp:77
---Type <return> to continue, or q <return> to quit---
#12 0x0000000000878358 in complete (bytes_transferred=0, ec=..., owner=..., 
this=0x601e000cbce0) at 
/usr/include/boost/asio/detail/task_io_service_operation.hpp:37
#13 boost::asio::detail::task_io_service::do_run_one 
(this=this@entry=0x601c000aa880, lock=..., this_thread=..., ec=...)
    at /usr/include/boost/asio/detail/impl/task_io_service.ipp:384
#14 0x000000000088a54c in boost::asio::detail::task_io_service::run 
(this=0x601c000aa880, ec=...) at 
/usr/include/boost/asio/detail/impl/task_io_service.ipp:153
#15 0x000000000088a959 in boost::asio::io_service::run (this=0x60040004eed0) at 
/usr/include/boost/asio/impl/io_service.ipp:59
#16 0x000000000089688f in operator() (this=<optimized out>) at 
/usr/include/boost/asio/detail/impl/resolver_service_base.ipp:32
#17 
boost::asio::detail::posix_thread::func<boost::asio::detail::resolver_service_ba
se::work_io_service_runner>::run (this=<optimized out>)
    at /usr/include/boost/asio/detail/posix_thread.hpp:82
#18 0x0000000000868ea4 in 
boost::asio::detail::boost_asio_detail_posix_thread_function 
(arg=0x60040006df30) at /usr/include/boost/asio/detail/impl/posix_thread.ipp:64
#19 0x00007f27a54deb98 in ?? () from /usr/lib/x86_64-linux-gnu/libasan.so.0
#20 0x00007f27a2ebb182 in start_thread (arg=0x7f2790d9b700) at 
pthread_create.c:312
#21 0x00007f27a23c830d in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 6 (Thread 0x7f278db22700 (LWP 1321)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at 
../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f27a3ba1816 in wait (time=18446744073709551615, this=0x601000068ba0) 
at thread/qwaitcondition_unix.cpp:86
#2  QWaitCondition::wait (this=this@entry=0x600c00450c48, 
mutex=mutex@entry=0x600c00450c38, time=time@entry=18446744073709551615) at 
thread/qwaitcondition_unix.cpp:158
#3  0x00000000006d9343 in RssParser::run (this=0x600c00450c20) at 
/home/ivan/d/qbittorrent/src/rss/rssparser.cpp:244
#4  0x00007f27a3ba132f in QThreadPrivate::start (arg=0x600c00450c20) at 
thread/qthread_unix.cpp:349
#5  0x00007f27a54deb98 in ?? () from /usr/lib/x86_64-linux-gnu/libasan.so.0
#6  0x00007f27a2ebb182 in start_thread (arg=0x7f278db22700) at 
pthread_create.c:312
#7  0x00007f27a23c830d in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 5 (Thread 0x7f278cf70700 (LWP 1322)):
#0  0x00007f27a23bafbd in poll () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007f27a19b5fe4 in g_main_context_poll (priority=2147483647, n_fds=1, 
fds=0x6004000cffd0, timeout=-1, context=0x60200008fe40)
    at /build/buildd/glib2.0-2.40.0/./glib/gmain.c:4028
#2  g_main_context_iterate (context=context@entry=0x60200008fe40, 
block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>)
    at /build/buildd/glib2.0-2.40.0/./glib/gmain.c:3729
#3  0x00007f27a19b60ec in g_main_context_iteration (context=0x60200008fe40, 
may_block=1) at /build/buildd/glib2.0-2.40.0/./glib/gmain.c:3795
#4  0x00007f27a3cd07a1 in QEventDispatcherGlib::processEvents 
(this=0x6004000cfff0, flags=...) at kernel/qeventdispatcher_glib.cpp:434
#5  0x00007f27a3ca20af in QEventLoop::processEvents 
(this=this@entry=0x7f278cf6fe00, flags=...) at kernel/qeventloop.cpp:149
#6  0x00007f27a3ca23a5 in QEventLoop::exec (this=this@entry=0x7f278cf6fe00, 
flags=...) at kernel/qeventloop.cpp:204
#7  0x00007f27a3b9ec5f in QThread::exec (this=<optimized out>) at 
thread/qthread.cpp:537
#8  0x00007f27a3ba132f in QThreadPrivate::start (arg=0x6004000d0930) at 
thread/qthread_unix.cpp:349
#9  0x00007f27a54deb98 in ?? () from /usr/lib/x86_64-linux-gnu/libasan.so.0
#10 0x00007f27a2ebb182 in start_thread (arg=0x7f278cf70700) at 
pthread_create.c:312
#11 0x00007f27a23c830d in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 4 (Thread 0x7f278bdeb700 (LWP 1323)):
#0  0x00007f27a23bafbd in poll () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007f27a19b5fe4 in g_main_context_poll (priority=2147483647, n_fds=1, 
fds=0x600c0063f140, timeout=-1, context=0x60200009fe40)
    at /build/buildd/glib2.0-2.40.0/./glib/gmain.c:4028
#2  g_main_context_iterate (context=context@entry=0x60200009fe40, 
block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>)
    at /build/buildd/glib2.0-2.40.0/./glib/gmain.c:3729
#3  0x00007f27a19b60ec in g_main_context_iteration (context=0x60200009fe40, 
may_block=1) at /build/buildd/glib2.0-2.40.0/./glib/gmain.c:3795
#4  0x00007f27a3cd07a1 in QEventDispatcherGlib::processEvents 
(this=0x6004000e9ff0, flags=...) at kernel/qeventdispatcher_glib.cpp:434
#5  0x00007f27a3ca20af in QEventLoop::processEvents 
(this=this@entry=0x7f278bdeae00, flags=...) at kernel/qeventloop.cpp:149
#6  0x00007f27a3ca23a5 in QEventLoop::exec (this=this@entry=0x7f278bdeae00, 
flags=...) at kernel/qeventloop.cpp:204
#7  0x00007f27a3b9ec5f in QThread::exec (this=<optimized out>) at 
thread/qthread.cpp:537
#8  0x00007f27a3ba132f in QThreadPrivate::start (arg=0x6004000ece90) at 
thread/qthread_unix.cpp:349
#9  0x00007f27a54deb98 in ?? () from /usr/lib/x86_64-linux-gnu/libasan.so.0
#10 0x00007f27a2ebb182 in start_thread (arg=0x7f278bdeb700) at 
pthread_create.c:312
#11 0x00007f27a23c830d in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 3 (Thread 0x7f2785ccf700 (LWP 1326)):
#0  0x00007f27a23bafbd in poll () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007f27a19b5fe4 in g_main_context_poll (priority=2147483647, n_fds=2, 
fds=0x600400305fb0, timeout=-1, context=0x6020000efe40)
    at /build/buildd/glib2.0-2.40.0/./glib/gmain.c:4028
#2  g_main_context_iterate (context=context@entry=0x6020000efe40, 
block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>)
---Type <return> to continue, or q <return> to quit---
    at /build/buildd/glib2.0-2.40.0/./glib/gmain.c:3729
#3  0x00007f27a19b60ec in g_main_context_iteration (context=0x6020000efe40, 
may_block=1) at /build/buildd/glib2.0-2.40.0/./glib/gmain.c:3795
#4  0x00007f27a3cd07be in QEventDispatcherGlib::processEvents 
(this=0x600400305ff0, flags=...) at kernel/qeventdispatcher_glib.cpp:436
#5  0x00007f27a3ca20af in QEventLoop::processEvents 
(this=this@entry=0x7f2785ccedc0, flags=...) at kernel/qeventloop.cpp:149
#6  0x00007f27a3ca23a5 in QEventLoop::exec (this=this@entry=0x7f2785ccedc0, 
flags=...) at kernel/qeventloop.cpp:204
#7  0x00007f27a3b9ec5f in QThread::exec (this=this@entry=0x600800d02010) at 
thread/qthread.cpp:537
#8  0x00007f27a3c83823 in QInotifyFileSystemWatcherEngine::run 
(this=0x600800d02010) at io/qfilesystemwatcher_inotify.cpp:265
#9  0x00007f27a3ba132f in QThreadPrivate::start (arg=0x600800d02010) at 
thread/qthread_unix.cpp:349
#10 0x00007f27a54deb98 in ?? () from /usr/lib/x86_64-linux-gnu/libasan.so.0
#11 0x00007f27a2ebb182 in start_thread (arg=0x7f2785ccf700) at 
pthread_create.c:312
#12 0x00007f27a23c830d in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 2 (Thread 0x7f2785110700 (LWP 1327)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at 
../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00000000008784cc in 
wait<boost::asio::detail::scoped_lock<boost::asio::detail::posix_mutex> > 
(lock=..., this=0x7f278510fd20)
    at /usr/include/boost/asio/detail/posix_event.hpp:80
#2  boost::asio::detail::task_io_service::do_run_one 
(this=this@entry=0x601c000c2360, lock=..., this_thread=..., ec=...)
    at /usr/include/boost/asio/detail/impl/task_io_service.ipp:395
#3  0x000000000088a54c in boost::asio::detail::task_io_service::run 
(this=0x601c000c2360, ec=...) at 
/usr/include/boost/asio/detail/impl/task_io_service.ipp:153
#4  0x000000000088a959 in boost::asio::io_service::run (this=0x60040006df10) at 
/usr/include/boost/asio/impl/io_service.ipp:59
#5  0x000000000089688f in operator() (this=<optimized out>) at 
/usr/include/boost/asio/detail/impl/resolver_service_base.ipp:32
#6  
boost::asio::detail::posix_thread::func<boost::asio::detail::resolver_service_ba
se::work_io_service_runner>::run (this=<optimized out>)
    at /usr/include/boost/asio/detail/posix_thread.hpp:82
#7  0x0000000000868ea4 in 
boost::asio::detail::boost_asio_detail_posix_thread_function 
(arg=0x60040032c1f0) at /usr/include/boost/asio/detail/impl/posix_thread.ipp:64
#8  0x00007f27a54deb98 in ?? () from /usr/lib/x86_64-linux-gnu/libasan.so.0
#9  0x00007f27a2ebb182 in start_thread (arg=0x7f2785110700) at 
pthread_create.c:312
#10 0x00007f27a23c830d in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 1 (Thread 0x7f27a86377c0 (LWP 1314)):
#0  0x00007f27a2ebc66b in pthread_join (threadid=139807922202368, 
thread_return=0x0) at pthread_join.c:92
#1  0x000000000086c924 in boost::asio::detail::posix_thread::join 
(this=0x60040004ee50) at /usr/include/boost/asio/detail/impl/posix_thread.ipp:42
#2  0x000000000098bd04 in libtorrent::aux::session_impl::~session_impl 
(this=0x6072001ea900, __in_chrg=<optimized out>) at session_impl.cpp:5996
#3  0x000000000098d30f in libtorrent::aux::session_impl::~session_impl 
(this=0x6072001ea900, __in_chrg=<optimized out>) at session_impl.cpp:6013
#4  0x00000000009325cc in checked_delete<libtorrent::aux::session_impl> 
(x=<optimized out>) at /usr/include/boost/checked_delete.hpp:34
#5  boost::detail::sp_counted_impl_p<libtorrent::aux::session_impl>::dispose 
(this=<optimized out>) at 
/usr/include/boost/smart_ptr/detail/sp_counted_impl.hpp:78
#6  0x000000000062c6ec in boost::detail::sp_counted_base::release 
(this=0x6006000fe320) at 
/usr/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp:146
#7  0x0000000000916cfd in ~shared_count (this=0x60040004eef8, 
__in_chrg=<optimized out>) at 
/usr/include/boost/smart_ptr/detail/shared_count.hpp:371
#8  ~shared_ptr (this=0x60040004eef0, __in_chrg=<optimized out>) at 
/usr/include/boost/smart_ptr/shared_ptr.hpp:328
#9  libtorrent::session::~session (this=0x60040004eef0, __in_chrg=<optimized 
out>) at session.cpp:450
#10 0x0000000000629af3 in QBtSession::~QBtSession (this=0x6026000278c0, 
__in_chrg=<optimized out>) at 
/home/ivan/d/qbittorrent/src/qtlibtorrent/qbtsession.cpp:198
#11 0x0000000000629d8f in QBtSession::~QBtSession (this=0x6026000278c0, 
__in_chrg=<optimized out>) at 
/home/ivan/d/qbittorrent/src/qtlibtorrent/qbtsession.cpp:206
#12 0x00000000005fe69d in QBtSession::drop () at 
/home/ivan/d/qbittorrent/src/qtlibtorrent/qbtsession.cpp:3002
#13 0x0000000000508bf8 in MainWindow::shutdownCleanUp (this=0x7fffc89c92b0) at 
/home/ivan/d/qbittorrent/src/mainwindow.cpp:357
#14 0x000000000082bc7a in MainWindow::qt_static_metacall (_o=<optimized out>, 
_c=<optimized out>, _id=<optimized out>, _a=0x7fffc89c8c80)
    at /home/ivan/d/qbittorrent-build/src/moc_mainwindow.cxx:175
#15 0x00007f27a3cb787a in QMetaObject::activate (sender=0x7fffc89c9270, 
m=m@entry=0x7f27a4007860 <QCoreApplication::staticMetaObject>, 
    local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x0) at kernel/qobject.cpp:3539
#16 0x00007f27a3d01ee0 in QCoreApplication::aboutToQuit (this=<optimized out>) 
at .moc/release-shared/moc_qcoreapplication.cpp:144
#17 0x00007f27a3ca7bd5 in QCoreApplication::exec () at 
kernel/qcoreapplication.cpp:1230
#18 0x00007f27a49db37c in QApplication::exec () at kernel/qapplication.cpp:3828
#19 0x000000000050476a in main (argc=<optimized out>, argv=<optimized out>) at 
/home/ivan/d/qbittorrent/src/main.cpp:399

Original issue reported on code.google.com by vanya...@gmail.com on 6 Dec 2014 at 12:28

GoogleCodeExporter commented 8 years ago
I've understood what happened.

boost::asio uses additional thread to do getaddrinfo. The requests here may 
take a few seconds to perform (or to timeout). When io_service is shutdown, it 
does not cancel all operation in queue, instead it waits until whole queue is 
processed. Which can take lots of time.

I don't know how to see the precise size of queue in debugger (as it is linked 
list). But effectively program can not terminate in tens minutes.

Note: And stopped_ is false in task_io_service::do_run_one. If stopped_ were 
true this loop would be breaked instantly.

Original comment by vanya...@gmail.com on 14 Dec 2014 at 9:47

GoogleCodeExporter commented 8 years ago
it's dangerous to stop the io_service with potentially critical jobs still in 
the queue. however, perhaps all hostname lookups could be moved to their own 
io_service and its own thread. that way just the DNS lookups could be cancelled.
it is a shame that DNS lookups can't be cancelled any other way (afaik) in 
boost.asio.

Original comment by arvid.no...@gmail.com on 14 Dec 2014 at 10:01

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Here a few thoughts:

1. async_resolver has function cancel(): 
http://www.boost.org/doc/libs/1_51_0/doc/html/boost_asio/reference/ip__basic_res
olver/cancel.html Perhaps some calls to cancel() are missing?

2. The size of resolve queue is very large. Before I killed qbittorrent, 832 
items had been processed.

3. The are lots of similar items in queue:

$ sort hosts-log | uniq -c
      3 host: 10.rarbg.com
      3 host: 10.rarbg.me
      7 host: 11.rarbg.com
      6 host: 11.rarbg.me
      5 host: 9.rarbg.com
      6 host: 9.rarbg.me
      3 host: denis.stalker.h3q.com
      3 host: fr33domtracker.h33t.com
    143 host: open.demonii.com
     26 host: tracker-ccc.de
     19 host: tracker.ccc.de
    194 host: tracker.istole.it
    215 host: tracker.openbittorrent.com
    193 host: tracker.publicbt.com
      1 host: tracker.thepiratebay.org
      5 host: tracker.torrentbox.com

I think if there are similar async_resolve requests in the queue libtorrent 
could merge them in one. This will dramatically decrease the size of the queue. 
Probably this even should be done on boost::asio level.

Original comment by vanya...@gmail.com on 15 Dec 2014 at 8:57

GoogleCodeExporter commented 8 years ago
I would expect the OS level lookup (getaddrinfo()) would cache results of 
lookups.

The thing with basic_resolver::cancel() is that (iirc) it cancels all lookups. 
Some lookups are actually required (or at least semi-important) during 
shutdown, to send the stopped event to trackers.

Anyway, in trunk I added another layer on top of boost.asio's resolver to add 
more aggressive caching and more aggressive timeout. I will look into improving 
it further by being able to cancel less important lookups.

Original comment by arvid.no...@gmail.com on 15 Dec 2014 at 9:36