This is a continue of previously opened issue [Unable to stop bitcoin-qt. ThreadDNSAddressSeed hangs. #16642](https://github.com/bitcoin/bitcoin/issues/16642#issue-481935673). Now hardware problems are sorted out. Single consumer-grade HDD on USB3.0 is changed for RAID1 of HGST Ultrastar® 7K4000 on SATA. Database was changed for know working archived version. Except already repaired HDD problem, hardware is stable, none failures or glitches was found for several month of operation under different operating systems.
The problem is sometimes Bitcoin Core, particularly bitcoin-qt, unable to finish it’s operation on close. I’m expecting normal bitcoin-qt application finishing after clicking “close” sign at top right corner of main GUI window. Actual behavior: after several successful application shutdowns, the application remains to hang with a message “Bitcoin Core is shutting down… Don’t shut down the computer until this window dissapears.” Natively compiled 01 Sep 2019 for arm-linux-gnueabihf, master branch.
Debug output:
02019-09-01T07:44:54Z GUI: requestShutdown : Requesting shutdown
12019-09-01T07:44:54Z GUI: shutdown : Running Shutdown in thread
22019-09-01T07:44:54Z Interrupting HTTP server
32019-09-01T07:44:54Z Interrupting HTTP RPC server
42019-09-01T07:44:54Z Interrupting RPC
52019-09-01T07:44:54Z addcon thread exit
62019-09-01T07:44:54Z opencon thread exit
72019-09-01T07:44:54Z msghand thread exit
82019-09-01T07:44:54Z Shutdown: In progress...
92019-09-01T07:44:54Z Stopping HTTP RPC server
102019-09-01T07:44:54Z Stopping RPC
112019-09-01T07:44:54Z Stopping HTTP server
122019-09-01T07:44:54Z Stopped HTTP server
132019-09-01T07:44:54Z net thread exit
142019-09-01T07:44:54Z BerkeleyEnvironment::Flush: [/bdb] Flush(false)
152019-09-01T07:44:54Z BerkeleyEnvironment::Flush: Flushing wallet.dat (refcount = 0)...
162019-09-01T07:44:55Z BerkeleyEnvironment::Flush: wallet.dat checkpoint
172019-09-01T07:44:55Z BerkeleyEnvironment::Flush: wallet.dat detach
182019-09-01T07:44:55Z BerkeleyEnvironment::Flush: wallet.dat closed
192019-09-01T07:44:55Z BerkeleyEnvironment::Flush: Flush(false) took 271ms
202019-09-01T07:58:54Z Flushed 64452 addresses to peers.dat 1854ms
212019-09-01T08:13:56Z Flushed 64452 addresses to peers.dat 2216ms
222019-09-01T08:22:11Z Potential stale tip detected, will try using extra outbound peer (last tip update: 2245 seconds ago)
232019-09-01T08:22:11Z net: setting try another outbound peer=true
242019-09-01T08:28:58Z Flushed 64452 addresses to peers.dat 1895ms
Threads after shutdown request:
0rock@Debian-Desktop:~$ ps -eLl
1...
2F S UID PID PPID LWP C PRI NI ADDR SZ WCHAN TTY TIME CMD
30 S 1000 3094 1336 3094 4 80 0 - 139807 poll_s pts/0 00:02:43 bitcoin-main
41 S 1000 3094 1336 3095 0 80 0 - 139807 poll_s pts/0 00:00:01 QXcbEventReader
51 S 1000 3094 1336 3097 0 80 0 - 139807 futex_ pts/0 00:00:00 mali-mem-purge
61 S 1000 3094 1336 3098 0 80 0 - 139807 futex_ pts/0 00:00:00 mali-utility-wo
71 S 1000 3094 1336 3099 0 80 0 - 139807 futex_ pts/0 00:00:00 mali-utility-wo
81 S 1000 3094 1336 3100 0 80 0 - 139807 futex_ pts/0 00:00:00 mali-utility-wo
91 S 1000 3094 1336 3101 0 80 0 - 139807 futex_ pts/0 00:00:00 mali-utility-wo
101 S 1000 3094 1336 3102 0 80 0 - 139807 futex_ pts/0 00:00:00 mali-utility-wo
111 S 1000 3094 1336 3103 0 80 0 - 139807 futex_ pts/0 00:00:00 mali-utility-wo
121 S 1000 3094 1336 3104 0 80 0 - 139807 poll_s pts/0 00:00:00 mali-cmar-backe
131 S 1000 3094 1336 3105 0 80 0 - 139807 futex_ pts/0 00:00:00 mali-hist-dump
141 S 1000 3094 1336 3106 0 80 0 - 139807 poll_s pts/0 00:00:00 QDBusConnection
151 S 1000 3094 1336 3112 3 80 0 - 139807 futex_ pts/0 00:01:54 bitcoin-shutoff
161 S 1000 3094 1336 3117 0 80 0 - 139807 futex_ pts/0 00:00:26 bitcoin-scriptc
171 S 1000 3094 1336 3118 0 80 0 - 139807 futex_ pts/0 00:00:17 bitcoin-schedul
181 S 1000 3094 1336 3122 17 80 0 - 139807 futex_ pts/0 00:09:23 bitcoin-qt-init
191 S 1000 3094 1336 3151 0 80 0 - 139807 sk_wai pts/0 00:00:00 bitcoin-dnsseed
201 S 1000 3094 1336 3156 0 80 0 - 139807 poll_s pts/0 00:00:00 QThread
211 S 1000 3094 1336 3157 0 80 0 - 139807 poll_s pts/0 00:00:00 Qt bearer threa
22...
The issue is reproducing quite reliable. With 0.18 versions on different computers, different builds I had this problem at least three times even after DB rescan. For some time the Core works normally but at some point, usually after network disturbance, it hangs on shutdown.
Now it is self-compiled from https://github.com/bitcoin/bitcoin.git Bitcoin Core version v0.18.99.0-495db72ee-dirty The machine is ROCKPro64, RK3399 CPU, 4GB RAM. Configure command was:
0./configure --enable-debug --enable-werror BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include" --with-boost-libdir=/usr/lib/arm-linux-gnueabihf
This time I compiled the Core with debug enabled. If being provided with more debug instructions I will try to investigate it deeper. After the compilation and installation, test_bitcoin was completed with none errors.
As I wrote in #16642 before, the problem persist not only at mine ARM CPU but on an Intel CPU too.
Thank you.