chrisidefix / libtorrent

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

assert in routing_table.cpp:458 #721

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This assert occurs quite often on my machine. qbittorrent 3.2.0alpha. 
libtorrent 1.0 r10791. As it seems limit 50 is quite arbitrary I'm going to 
raise it and see if it works.

assertion failed. Please file a bugreport at 
http://code.google.com/p/libtorrent/issues
Please include the following information:

version: 1.0.3.0
$Rev$

file: 'kademlia/routing_table.cpp'
line: 458
function: bool 
libtorrent::dht::routing_table::add_node(libtorrent::dht::node_entry)
expression: m_buckets.size() <= 50

stack:
1: assert_fail(char const*, int, char const*, char const*, char const*, int)
2: libtorrent::dht::routing_table::add_node(libtorrent::dht::node_entry)
3: libtorrent::dht::routing_table::heard_about(libtorrent::sha1_hash const&, 
boost::asio::ip::basic_endpoint<boost::asio::ip::udp> const&)
4: libtorrent::dht::node_impl::incoming_request(libtorrent::dht::msg const&, 
libtorrent::entry&)
5: libtorrent::dht::node_impl::incoming(libtorrent::dht::msg const&)
6: ) [0xc1aa00]
7: ) [0xb90360]
8: ) [0xb9183e]
9: ) [0xb924db]
10: ) [0xba239b]
11: 
boost::asio::detail::epoll_reactor::descriptor_state::do_complete(boost::asio::d
etail::task_io_service*, boost::asio::detail::task_io_service_operation*, 
boost::system::error_code const&, unsigned long)
12: 
boost::asio::detail::task_io_service::do_run_one(boost::asio::detail::scoped_loc
k<boost::asio::detail::posix_mutex>&, 
boost::asio::detail::task_io_service_thread_info&, boost::system::error_code 
const&)
13: boost::asio::detail::task_io_service::run(boost::system::error_code&)
14: boost::asio::io_service::run(boost::system::error_code&)
15: libtorrent::aux::session_impl::main_thread()
16: ) [0x95a16c]
17: boost_asio_detail_posix_thread_function
18: 
19: 
20: clone

*************************************************************
Catching SIGABRT, please report a bug at http://bug.qbittorrent.org
and provide the following backtrace:
qBittorrent version: v3.2.0alpha
stack trace:
  /lib/x86_64-linux-gnu/libc.so.6 : ()+0x36c30  [0x7f4fea651c30]
  /lib/x86_64-linux-gnu/libc.so.6 : gsignal()+0x39  [0x7f4fea651bb9]
  /lib/x86_64-linux-gnu/libc.so.6 : abort()+0x148  [0x7f4fea654fc8]
  ./qbittorrent() [0x833891]
  ./qbittorrent : libtorrent::dht::routing_table::add_node(libtorrent::dht::node_entry)+0xdb  [0xc49a73]
  ./qbittorrent : libtorrent::dht::routing_table::heard_about(libtorrent::sha1_hash const&, boost::asio::ip::basic_endpoint<boost::asio::ip::udp> const&)+0x1db  [0xc49de3]
  ./qbittorrent : libtorrent::dht::node_impl::incoming_request(libtorrent::dht::msg const&, libtorrent::entry&)+0xa53  [0xc32ebb]
  ./qbittorrent : libtorrent::dht::node_impl::incoming(libtorrent::dht::msg const&)+0x76d  [0xc36f21]
  ./qbittorrent() [0xc1aa00]
  ./qbittorrent() [0xb90360]
  ./qbittorrent() [0xb9183e]
  ./qbittorrent() [0xb924db]
  ./qbittorrent() [0xba239b]
  ./qbittorrent : boost::asio::detail::epoll_reactor::descriptor_state::do_complete(boost::asio::detail::task_io_service*, boost::asio::detail::task_io_service_operation*, boost::system::error_code const&, unsigned long)+0x4a  [0x80cad0]
  ./qbittorrent : boost::asio::detail::task_io_service::do_run_one(boost::asio::detail::scoped_lock<boost::asio::detail::posix_mutex>&, boost::asio::detail::task_io_service_thread_info&, boost::system::error_code const&)+0x87a  [0x80fc58]
  ./qbittorrent : boost::asio::detail::task_io_service::run(boost::system::error_code&)+0x3c0  [0x821e4c]
  ./qbittorrent : boost::asio::io_service::run(boost::system::error_code&)+0x29  [0x8222e3]
  ./qbittorrent : libtorrent::aux::session_impl::main_thread()+0x116  [0x942ad4]
  ./qbittorrent() [0x95a16c]
  ./qbittorrent : boost_asio_detail_posix_thread_function()+0x40  [0x8007a4]
  /usr/lib/x86_64-linux-gnu/libasan.so.0 : ()+0x18b98  [0x7f4fed82cb98]
  /lib/x86_64-linux-gnu/libpthread.so.0 : ()+0x8182  [0x7f4feb209182]
  /lib/x86_64-linux-gnu/libc.so.6 : clone()+0x6d  [0x7f4fea715efd]
Аварийный останов
ivan@liberty:~/d/qbittorrent-build$ ldd qbittorrent 
        linux-vdso.so.1 =>  (0x00007fff449f2000)
        libasan.so.0 => /usr/lib/x86_64-linux-gnu/libasan.so.0 (0x00007ff8ceb22000)
        libQtGui.so.4 => /usr/lib/x86_64-linux-gnu/libQtGui.so.4 (0x00007ff8cde6f000)
        libQtDBus.so.4 => /usr/lib/x86_64-linux-gnu/libQtDBus.so.4 (0x00007ff8cdbf3000)
        libQtXml.so.4 => /usr/lib/x86_64-linux-gnu/libQtXml.so.4 (0x00007ff8cd9ae000)
        libQtNetwork.so.4 => /usr/lib/x86_64-linux-gnu/libQtNetwork.so.4 (0x00007ff8cd666000)
        libQtCore.so.4 => /usr/lib/x86_64-linux-gnu/libQtCore.so.4 (0x00007ff8cd180000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007ff8ccf67000)
        libboost_system.so.1.54.0 => /usr/lib/x86_64-linux-gnu/libboost_system.so.1.54.0 (0x00007ff8ccd63000)
        libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007ff8ccb04000)
        libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007ff8cc72a000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff8cc50c000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007ff8cc207000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ff8cbf01000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ff8cbceb000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff8cb924000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ff8cb720000)
        /lib64/ld-linux-x86-64.so.2 (0x00007ff8d1ae0000)
        libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007ff8cb4e4000)
        libaudio.so.2 => /usr/lib/x86_64-linux-gnu/libaudio.so.2 (0x00007ff8cb2cb000)
        libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007ff8cafc3000)
        libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007ff8cad9d000)
        libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007ff8caaf9000)
        libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007ff8ca8a8000)
        libSM.so.6 => /usr/lib/x86_64-linux-gnu/libSM.so.6 (0x00007ff8ca6a0000)
        libICE.so.6 => /usr/lib/x86_64-linux-gnu/libICE.so.6 (0x00007ff8ca483000)
        libXi.so.6 => /usr/lib/x86_64-linux-gnu/libXi.so.6 (0x00007ff8ca273000)
        libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007ff8ca069000)
        libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007ff8c9e56000)
        libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007ff8c9b21000)
        libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007ff8c98dc000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007ff8c96d3000)
        libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007ff8c94a9000)
        libXt.so.6 => /usr/lib/x86_64-linux-gnu/libXt.so.6 (0x00007ff8c9242000)
        libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007ff8c903e000)
        libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007ff8c8e00000)
        libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007ff8c8bf7000)
        libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007ff8c89f2000)
        libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007ff8c87d2000)
        libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007ff8c85cc000)

Original issue reported on code.google.com by vanya...@gmail.com on 16 Feb 2015 at 12:03

GoogleCodeExporter commented 9 years ago
diff --git a/src/kademlia/routing_table.cpp b/src/kademlia/routing_table.cpp
index 8df6cf3..4642bef 100644
--- a/src/kademlia/routing_table.cpp
+++ b/src/kademlia/routing_table.cpp
@@ -443,6 +443,8 @@ void routing_table::remove_node(node_entry* n

 bool routing_table::add_node(node_entry e)
 {
+       static size_t max_bucket_size = 50;
+       
        add_node_status_t s = add_node_impl(e);
        if (s == failed_to_add) return false;
        if (s == node_added) return true;
@@ -455,16 +457,11 @@ bool routing_table::add_node(node_entry e)
                // harden our resistence towards this attack. Perhaps by never
                // splitting a bucket (and discard nodes) if the two buckets above it
                // are empty or close to empty
-               TORRENT_ASSERT(m_buckets.size() <= 50);
-               if (m_buckets.size() > 50)
+               //TORRENT_ASSERT(m_buckets.size() <= 100);
+               if (m_buckets.size() > max_bucket_size)
                {
-                       // this is a sanity check. In the wild, we shouldn't 
see routing
-                       // tables deeper than 26 or 27. If we get this deep, 
there might
-                       // be a bug in the bucket splitting logic, or there may 
be someone
-                       // playing a prank on us, spoofing node IDs.
-                       s = add_node_impl(e);
-                       if (s == node_added) return true;
-                       return false;
+                       std::cerr << "max bucket limit exceeded: " << 
m_buckets.size() << std::endl;
+                       max_bucket_size = m_buckets.size();
                }

                // if the new bucket still has too many nodes in it, we need to keep

Original comment by vanya...@gmail.com on 16 Feb 2015 at 12:23

GoogleCodeExporter commented 9 years ago
I'm running qbittorrent for 2 day now. And not I've a few traces. The max limit 
I've got is 82:

max bucket limit exceeded: 51
max bucket limit exceeded: 52
max bucket limit exceeded: 53
max bucket limit exceeded: 54
max bucket limit exceeded: 55
max bucket limit exceeded: 56
max bucket limit exceeded: 57
max bucket limit exceeded: 58
max bucket limit exceeded: 59
max bucket limit exceeded: 60
max bucket limit exceeded: 61
max bucket limit exceeded: 62
max bucket limit exceeded: 63
max bucket limit exceeded: 64
max bucket limit exceeded: 65
max bucket limit exceeded: 66
max bucket limit exceeded: 67
max bucket limit exceeded: 68
max bucket limit exceeded: 69
max bucket limit exceeded: 70
max bucket limit exceeded: 71
max bucket limit exceeded: 72
max bucket limit exceeded: 73
max bucket limit exceeded: 74
max bucket limit exceeded: 75
max bucket limit exceeded: 76
max bucket limit exceeded: 77
max bucket limit exceeded: 78
max bucket limit exceeded: 79
max bucket limit exceeded: 80
max bucket limit exceeded: 81
max bucket limit exceeded: 82

Original comment by vanya...@gmail.com on 17 Feb 2015 at 10:03

GoogleCodeExporter commented 9 years ago
I wonder what the distribution of nodes look like there. do you know how many 
nodes in total you have in your routing table?

Original comment by arvid.no...@gmail.com on 17 Feb 2015 at 11:46

GoogleCodeExporter commented 9 years ago
> do you know how many nodes in total you have in your routing table?

No. But if you send me a patch that dump necessary information, I will apply it.

Original comment by vanya...@gmail.com on 18 Feb 2015 at 8:04