Deadlock during startup (Appears to be AddAddress / DNSSeed related) #737

issue gmaxwell opened this issue on January 2, 2012
  1. gmaxwell commented at 11:04 PM on January 2, 2012: contributor

    Node deadlocks sometimes shortly after startup in githead. Appears to happen when a link comes up so fast that AddAddress and DNSSeed happen concurrently.

    (gdb) bt
    [#0](/bitcoin-bitcoin/0/)  0x000000301f20b71e in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
    [#1](/bitcoin-bitcoin/1/)  0x00007f11b4d790a9 in boost::this_thread::sleep(boost::posix_time::ptime const&) () from /usr/lib64/libboost_thread-mt.so.1.44.0
    [#2](/bitcoin-bitcoin/2/)  0x000000000043e702 in sleep (argc=<value optimized out>, argv=<value optimized out>) at /usr/include/boost/thread/detail/thread.hpp:346
    [#3](/bitcoin-bitcoin/3/)  Sleep (argc=<value optimized out>, argv=<value optimized out>) at util.h:103
    [#4](/bitcoin-bitcoin/4/)  AppInit2 (argc=<value optimized out>, argv=<value optimized out>) at init.cpp:537
    [#5](/bitcoin-bitcoin/5/)  0x000000000043f829 in AppInit (argc=<value optimized out>, argv=<value optimized out>) at init.cpp:112
    [#6](/bitcoin-bitcoin/6/)  0x000000000043f8c9 in main (argc=<value optimized out>, argv=<value optimized out>) at init.cpp:98
    (gdb) thread 0
    Thread ID 0 not known.
    (gdb) thread 1
    [Switching to thread 1 (Thread 0x7f11b3a5a800 (LWP 415))]#0  0x000000301f20b71e in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
    (gdb) bt
    [#0](/bitcoin-bitcoin/0/)  0x000000301f20b71e in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
    [#1](/bitcoin-bitcoin/1/)  0x00007f11b4d790a9 in boost::this_thread::sleep(boost::posix_time::ptime const&) () from /usr/lib64/libboost_thread-mt.so.1.44.0
    [#2](/bitcoin-bitcoin/2/)  0x000000000043e702 in sleep (argc=<value optimized out>, argv=<value optimized out>) at /usr/include/boost/thread/detail/thread.hpp:346
    [#3](/bitcoin-bitcoin/3/)  Sleep (argc=<value optimized out>, argv=<value optimized out>) at util.h:103
    [#4](/bitcoin-bitcoin/4/)  AppInit2 (argc=<value optimized out>, argv=<value optimized out>) at init.cpp:537
    [#5](/bitcoin-bitcoin/5/)  0x000000000043f829 in AppInit (argc=<value optimized out>, argv=<value optimized out>) at init.cpp:112
    [#6](/bitcoin-bitcoin/6/)  0x000000000043f8c9 in main (argc=<value optimized out>, argv=<value optimized out>) at init.cpp:98
    (gdb) thread 2
    [Switching to thread 2 (Thread 0x7f11a57fa700 (LWP 447))]#0  0x000000301f20b3b4 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
    (gdb) bt
    [#0](/bitcoin-bitcoin/0/)  0x000000301f20b3b4 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
    [#1](/bitcoin-bitcoin/1/)  0x00007f11b4a055bb in __db_pthread_mutex_lock () from /usr/lib64/libdb_cxx-4.8.so
    [#2](/bitcoin-bitcoin/2/)  0x00007f11b4a04b72 in __db_tas_mutex_lock () from /usr/lib64/libdb_cxx-4.8.so
    [#3](/bitcoin-bitcoin/3/)  0x00007f11b4a98984 in __lock_get_internal () from /usr/lib64/libdb_cxx-4.8.so
    [#4](/bitcoin-bitcoin/4/)  0x00007f11b4a98e02 in __lock_get () from /usr/lib64/libdb_cxx-4.8.so
    [#5](/bitcoin-bitcoin/5/)  0x00007f11b4ac837e in __db_lget () from /usr/lib64/libdb_cxx-4.8.so
    [#6](/bitcoin-bitcoin/6/)  0x00007f11b4a22140 in __bam_get_root () from /usr/lib64/libdb_cxx-4.8.so
    [#7](/bitcoin-bitcoin/7/)  0x00007f11b4a223d5 in __bam_search () from /usr/lib64/libdb_cxx-4.8.so
    [#8](/bitcoin-bitcoin/8/)  0x00007f11b4a0dda6 in ?? () from /usr/lib64/libdb_cxx-4.8.so
    [#9](/bitcoin-bitcoin/9/)  0x00007f11b4a121cf in ?? () from /usr/lib64/libdb_cxx-4.8.so
    [#10](/bitcoin-bitcoin/10/) 0x00007f11b4ab83c9 in __dbc_iput () from /usr/lib64/libdb_cxx-4.8.so
    [#11](/bitcoin-bitcoin/11/) 0x00007f11b4aba2aa in __dbc_put () from /usr/lib64/libdb_cxx-4.8.so
    [#12](/bitcoin-bitcoin/12/) 0x00007f11b4aac4ee in __db_put () from /usr/lib64/libdb_cxx-4.8.so
    [#13](/bitcoin-bitcoin/13/) 0x00007f11b4ac537b in __db_put_pp () from /usr/lib64/libdb_cxx-4.8.so
    [#14](/bitcoin-bitcoin/14/) 0x00007f11b49fa2db in Db::put(DbTxn*, Dbt*, Dbt*, unsigned int) () from /usr/lib64/libdb_cxx-4.8.so
    [#15](/bitcoin-bitcoin/15/) 0x000000000042bb32 in bool CDB::Write<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<unsigned char, std::allocator<unsigned char> > >, CAddress>(std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<unsigned char, std::allocator<unsigned char> > > const&, CAddress const&, bool) ()
    [#16](/bitcoin-bitcoin/16/) 0x0000000000419402 in CAddrDB::WriteAddress (this=0x7f11a57f8a70, addr=...) at db.cpp:620
    [#17](/bitcoin-bitcoin/17/) 0x0000000000486689 in AddressCurrentlyConnected (addr=<value optimized out>) at net.cpp:512
    [#18](/bitcoin-bitcoin/18/) 0x0000000000467a9c in ProcessMessage (pfrom=0x7f1198001800, strCommand="version", vRecv=<value optimized out>) at main.cpp:2455
    [#19](/bitcoin-bitcoin/19/) 0x000000000046b651 in ProcessMessages (pfrom=0x7f1198001800) at main.cpp:2544
    [#20](/bitcoin-bitcoin/20/) 0x000000000048747c in ThreadMessageHandler2 (parg=<value optimized out>) at net.cpp:1633
    [#21](/bitcoin-bitcoin/21/) 0x000000000048767a in ThreadMessageHandler (parg=0x0) at net.cpp:1598
    [#22](/bitcoin-bitcoin/22/) 0x000000301f206ccb in start_thread () from /lib64/libpthread.so.0
    [#23](/bitcoin-bitcoin/23/) 0x000000301eee0c2d in clone () from /lib64/libc.so.6
    (gdb) thread 3
    [Switching to thread 3 (Thread 0x7f11a5ffb700 (LWP 446))]#0  0x000000301f20b71e in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
    (gdb) bt
    [#0](/bitcoin-bitcoin/0/)  0x000000301f20b71e in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
    [#1](/bitcoin-bitcoin/1/)  0x00007f11b4d790a9 in boost::this_thread::sleep(boost::posix_time::ptime const&) () from /usr/lib64/libboost_thread-mt.so.1.44.0
    [#2](/bitcoin-bitcoin/2/)  0x000000000044118d in Sleep(long long) ()
    [#3](/bitcoin-bitcoin/3/)  0x000000000048b0f2 in ThreadOpenConnections2 (parg=<value optimized out>) at net.cpp:1415
    [#4](/bitcoin-bitcoin/4/)  0x000000000048baaa in ThreadOpenConnections (parg=0x0) at net.cpp:1386
    [#5](/bitcoin-bitcoin/5/)  0x000000301f206ccb in start_thread () from /lib64/libpthread.so.0
    [#6](/bitcoin-bitcoin/6/)  0x000000301eee0c2d in clone () from /lib64/libc.so.6
    (gdb) thread 4
    [Switching to thread 4 (Thread 0x7f11a67fc700 (LWP 445))]#0  0x000000301f20b71e in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
    (gdb) bt
    [#0](/bitcoin-bitcoin/0/)  0x000000301f20b71e in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
    [#1](/bitcoin-bitcoin/1/)  0x00007f11b4d790a9 in boost::this_thread::sleep(boost::posix_time::ptime const&) () from /usr/lib64/libboost_thread-mt.so.1.44.0
    [#2](/bitcoin-bitcoin/2/)  0x000000000044118d in Sleep(long long) ()
    [#3](/bitcoin-bitcoin/3/)  0x000000000048a5a7 in ThreadSocketHandler2 (parg=<value optimized out>) at net.cpp:1108
    [#4](/bitcoin-bitcoin/4/)  0x000000000048a9ea in ThreadSocketHandler (parg=0x0) at net.cpp:808
    [#5](/bitcoin-bitcoin/5/)  0x000000301f206ccb in start_thread () from /lib64/libpthread.so.0
    [#6](/bitcoin-bitcoin/6/)  0x000000301eee0c2d in clone () from /lib64/libc.so.6
    (gdb) thread 5
    [Switching to thread 5 (Thread 0x7f11a77fe700 (LWP 443))]#0  0x000000301f20dc9c in __lll_lock_wait () from /lib64/libpthread.so.0
    (gdb) bt
    [#0](/bitcoin-bitcoin/0/)  0x000000301f20dc9c in __lll_lock_wait () from /lib64/libpthread.so.0
    [#1](/bitcoin-bitcoin/1/)  0x000000301f209125 in _L_lock_880 () from /lib64/libpthread.so.0
    [#2](/bitcoin-bitcoin/2/)  0x000000301f209008 in pthread_mutex_lock () from /lib64/libpthread.so.0
    [#3](/bitcoin-bitcoin/3/)  0x00000000004edfc5 in lock (this=0x7640a0, pszName=<value optimized out>, pszFile=0x5127e3 "net.cpp", nLine=<value optimized out>)
        at /usr/include/boost/interprocess/sync/posix/interprocess_recursive_mutex.hpp:53
    [#4](/bitcoin-bitcoin/4/)  CCriticalSection::Enter (this=0x7640a0, pszName=<value optimized out>, pszFile=0x5127e3 "net.cpp", nLine=<value optimized out>) at util.cpp:1130
    [#5](/bitcoin-bitcoin/5/)  0x00000000004868aa in CCriticalBlock (addr=..., nTimePenalty=<value optimized out>, pAddrDB=0x7f11a77fdd30) at util.h:228
    [#6](/bitcoin-bitcoin/6/)  AddAddress (addr=..., nTimePenalty=<value optimized out>, pAddrDB=0x7f11a77fdd30) at net.cpp:451
    [#7](/bitcoin-bitcoin/7/)  0x0000000000486f4d in ThreadDNSAddressSeed2 (parg=<value optimized out>) at net.cpp:1286
    [#8](/bitcoin-bitcoin/8/)  0x00000000004870ca in ThreadDNSAddressSeed (parg=0x0) at net.cpp:1253
    [#9](/bitcoin-bitcoin/9/)  0x000000301f206ccb in start_thread () from /lib64/libpthread.so.0
    [#10](/bitcoin-bitcoin/10/) 0x000000301eee0c2d in clone () from /lib64/libc.so.6
    (gdb) thread 6
    [Switching to thread 6 (Thread 0x7f11a7fff700 (LWP 442))]#0  0x000000301f20dc9c in __lll_lock_wait () from /lib64/libpthread.so.0
    (gdb) bt
    [#0](/bitcoin-bitcoin/0/)  0x000000301f20dc9c in __lll_lock_wait () from /lib64/libpthread.so.0
    [#1](/bitcoin-bitcoin/1/)  0x000000301f209125 in _L_lock_880 () from /lib64/libpthread.so.0
    [#2](/bitcoin-bitcoin/2/)  0x000000301f209008 in pthread_mutex_lock () from /lib64/libpthread.so.0
    [#3](/bitcoin-bitcoin/3/)  0x00000000004edfc5 in lock (this=0x763960, pszName=<value optimized out>, pszFile=0x513a0e "bitcoinrpc.cpp", nLine=<value optimized out>)
        at /usr/include/boost/interprocess/sync/posix/interprocess_recursive_mutex.hpp:53
    [#4](/bitcoin-bitcoin/4/)  CCriticalSection::Enter (this=0x763960, pszName=<value optimized out>, pszFile=0x513a0e "bitcoinrpc.cpp", nLine=<value optimized out>)
        at util.cpp:1130
    [#5](/bitcoin-bitcoin/5/)  0x00000000004accb9 in CCriticalBlock (parg=<value optimized out>) at util.h:228
    [#6](/bitcoin-bitcoin/6/)  ThreadRPCServer2 (parg=<value optimized out>) at bitcoinrpc.cpp:2422
    [#7](/bitcoin-bitcoin/7/)  0x00000000004ad93a in ThreadRPCServer (parg=0x0) at bitcoinrpc.cpp:2249
    [#8](/bitcoin-bitcoin/8/)  0x000000301f206ccb in start_thread () from /lib64/libpthread.so.0
    [#9](/bitcoin-bitcoin/9/)  0x000000301eee0c2d in clone () from /lib64/libc.so.6
    (gdb) thread 7
    [Switching to thread 7 (Thread 0x7f11ad3c5700 (LWP 440))]#0  0x000000301f20e6ed in nanosleep () from /lib64/libpthread.so.0
    (gdb) bt
    [#0](/bitcoin-bitcoin/0/)  0x000000301f20e6ed in nanosleep () from /lib64/libpthread.so.0
    [#1](/bitcoin-bitcoin/1/)  0x00007f11b4d79306 in boost::this_thread::sleep(boost::posix_time::ptime const&) () from /usr/lib64/libboost_thread-mt.so.1.44.0
    [#2](/bitcoin-bitcoin/2/)  0x000000000041c176 in sleep (parg=0x16188a8) at /usr/include/boost/thread/detail/thread.hpp:346
    [#3](/bitcoin-bitcoin/3/)  Sleep (parg=0x16188a8) at util.h:103
    [#4](/bitcoin-bitcoin/4/)  ThreadFlushWalletDB (parg=0x16188a8) at db.cpp:995
    [#5](/bitcoin-bitcoin/5/)  0x000000301f206ccb in start_thread () from /lib64/libpthread.so.0
    [#6](/bitcoin-bitcoin/6/)  0x000000301eee0c2d in clone () from /lib64/libc.so.6
    (gdb) thread 8
    Thread ID 8 not known.
    
  2. sipa referenced this in commit 0d5d8ff433 on Jan 2, 2012
  3. sipa referenced this in commit ff9479348c on Jan 2, 2012
  4. gmaxwell commented at 1:11 AM on January 3, 2012: contributor

    Fixed by 6ceeb3e917e5435bc5faac222fe14f3343be99f7

  5. gmaxwell closed this on Jan 3, 2012

  6. destenson referenced this in commit f39bc3b3cb on Jun 26, 2016
  7. rajarshimaitra referenced this in commit 9512e3f929 on Aug 5, 2021
  8. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 18:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me