<p>At shutdown, the chainstate cache has to be flushed to disk. The bigger you set <code>dbcache</code>, the bigger this cache can grow, and the longer it can take to flush it.</p>

CC BY-SA 4.0
2022-08-31T06:05:19.450Z
it would be good to have a descriptive log entry for this before the expected hang, so users have an idea that its to be expected
mikew
CC BY-SA 4.0
2022-09-30T18:20:19.843Z
Oops just seeing this now - thanks for the explanation Pieter.
billygarrison
CC BY-SA 4.0
2022-08-06T01:33:16.883Z
2022-08-06T01:33:16.883Z
Pieter Wuille
<p>I just installed Bitcoin Core on a new machine and completed IBD using dbcache ~24000. It took ~40 mins to shutdown for the first time (after running for about 24 hours and completing the IBD). I'm wondering if this is normal, or if it could be related to either IBD or having such a high dbcache?</p>
<p>Shutdown logs for reference:</p>
<pre><code>2022-08-05T22:39:55Z tor: Thread interrupt
2022-08-05T22:39:55Z addcon thread exit
2022-08-05T22:39:55Z torcontrol thread exit
2022-08-05T22:39:55Z opencon thread exit
2022-08-05T22:39:55Z Shutdown: In progress...
2022-08-05T22:39:55Z msghand thread exit
2022-08-05T22:39:55Z net thread exit
2022-08-05T22:39:55Z DumpAnchors: Flush 2 outbound block-relay-only peer addresses to anchors.dat started
2022-08-05T22:39:55Z DumpAnchors: Flush 2 outbound block-relay-only peer addresses to anchors.dat completed (0.02s)
2022-08-05T22:39:55Z scheduler thread exit
2022-08-05T22:39:55Z Writing 0 unbroadcast transactions to disk.
2022-08-05T22:39:56Z Dumped mempool: 0.003643s to copy, 0.227474s to dump

&lt;hangs here for 40 mins&gt;

2022-08-05T23:18:52Z Shutdown: done

</code></pre>

<bitcoin-core><bitcoind>
What can cause bitcoind to take a long time to shutdown?
billygarrison
# What can cause bitcoind to take a long time to shutdown?

(Asked by: username_0 on 2022-08-06)

I just installed Bitcoin Core on a new machine and completed IBD using dbcache ~24000. It took ~40 mins to shutdown for the first time (after running for about 24 hours and completing the IBD). I'm wondering if this is normal, or if it could be related to either IBD or having such a high dbcache?

Shutdown logs for reference:

```
2022-08-05T22:39:55Z tor: Thread interrupt
2022-08-05T22:39:55Z addcon thread exit
2022-08-05T22:39:55Z torcontrol thread exit
2022-08-05T22:39:55Z opencon thread exit
2022-08-05T22:39:55Z Shutdown: In progress...
2022-08-05T22:39:55Z msghand thread exit
2022-08-05T22:39:55Z net thread exit
2022-08-05T22:39:55Z DumpAnchors: Flush 2 outbound block-relay-only peer addresses to anchors.dat started
2022-08-05T22:39:55Z DumpAnchors: Flush 2 outbound block-relay-only peer addresses to anchors.dat completed (0.02s)
2022-08-05T22:39:55Z scheduler thread exit
2022-08-05T22:39:55Z Writing 0 unbroadcast transactions to disk.
2022-08-05T22:39:56Z Dumped mempool: 0.003643s to copy, 0.227474s to dump

<hangs here for 40 mins>

2022-08-05T23:18:52Z Shutdown: done

```

**Tags:** bitcoin-core, bitcoind


---

## 1 answers

### Answer by username_1 on 2022-08-06. Score: 7

At shutdown, the chainstate cache has to be flushed to disk. The bigger you set `dbcache`, the bigger this cache can grow, and the longer it can take to flush it.

> **Comments:**
> **username_2**: it would be good to have a descriptive log entry for this before the expected hang, so users have an idea that its to be expected  
> **username_0**: Oops just seeing this now - thanks for the explanation username_1.  

---

