<p>Send the RPC Stop command:</p>

<pre><code>cd "C:\Program Files (x86)\Bitcoin\daemon"
bitcoind stop
</code></pre>

<p>Output</p>

<pre><code>ThreadRPCServer method=stop
Flush(false)
blkindex.dat refcount=0
blkindex.dat checkpoint
ThreadSocketHandler exited
blkindex.dat detach
ThreadMessageHandler exited
connection timeout
ThreadOpenConnections exited
ThreadDumpAddress exited

blkindex.dat closed
DBFlush(false) ended          219780ms
StopNode()
Flushed 12513 addresses to peers.dat  280ms
Flush(true)
DBFlush(true) ended               0ms
Bitcoin exited
</code></pre>

CC BY-SA 3.0
2012-12-13T18:43:45.550Z
2012-12-13T18:43:45.550Z
makerofthings7
<p>I am running bitcoind in Windows (interactively) and pressed "control c".  The following error was displayed:</p>

<pre><code>EnvShutdown exception: DB_RUNRECOVERY: Fatal error, run database recovery (-30974)
</code></pre>

<ul>
<li><p>Is this a bogus error, or could it lead to serious issues?  </p></li>
<li><p>Did this delay my restart time?</p></li>
</ul>

<p>This is the output after I restarted bitcoind: </p>

<pre><code>Bitcoin version v0.7.1-beta (2012-10-09 13:22:09 -0400)
Using OpenSSL version OpenSSL 1.0.1c 10 May 2012
Startup time: 12/09/12 02:35:45
Default data directory C:\Users\Administrator\AppData\Roaming\Bitcoin
Used data directory C:\Users\Administrator\AppData\Roaming\Bitcoin
dbenv.open LogDir=C:\Users\Administrator\AppData\Roaming\Bitcoin\database 

ErrorFile=C:\Users\Administrator\AppData\Roaming\Bitcoin\db.log
Bound to [::]:8333
Bound to 0.0.0.0:8333
Loading block index...
LoadBlockIndex(): hashBestChain=0000000000000451ad20  height=193797  date=08/14/12 03:38:39
Verifying last 2500 blocks at level 1
 block index          158518ms
Loading wallet...
nFileVersion = 70100
 wallet                  858ms
Rescanning last 3 blocks (from block 193794)...
 rescan                   47ms
Loading addresses...
Loaded 12371 addresses from peers.dat  78ms
RandAddSeed() 164540 bytes
mapBlockIndex.size() = 193799
nBestHeight = 193797
setKeyPool.size() = 100
mapWallet.size() = 0
mapAddressBook.size() = 1
Done loading
send version message: version 60002, blocks=193797, us=0.0.0.0:0, them=0.0.0.0:0, peer=127.0.0.1:0
sending: version (100 bytes)
ThreadRPCServer started
</code></pre>

CC BY-SA 4.0
2019-02-12T23:07:58.957Z
A fix for this was pushed April 30, 2018. See https://github.com/bitcoin/bitcoin/blob/029d28a7aa5619973eb59fe445b9a4186c0c2a58/src/init.cpp#L914
Brannon
<bitcoind><windows>
How do I properly shut down bitcoind on Windows? I get error: EnvShutdown exception: DB_RUNRECOVERY: Fatal error, run database recovery (-30974)
makerofthings7
# How do I properly shut down bitcoind on Windows? I get error: EnvShutdown exception: DB_RUNRECOVERY: Fatal error, run database recovery (-30974)

(Asked by: username_0 on 2012-12-09)

I am running bitcoind in Windows (interactively) and pressed "control c". The following error was displayed:

```
EnvShutdown exception: DB_RUNRECOVERY: Fatal error, run database recovery (-30974)

```

* Is this a bogus error, or could it lead to serious issues?
* Did this delay my restart time?

This is the output after I restarted bitcoind:

```
Bitcoin version v0.7.1-beta (2012-10-09 13:22:09 -0400)
Using OpenSSL version OpenSSL 1.0.1c 10 May 2012
Startup time: 12/09/12 02:35:45
Default data directory C:\Users\Administrator\AppData\Roaming\Bitcoin
Used data directory C:\Users\Administrator\AppData\Roaming\Bitcoin
dbenv.open LogDir=C:\Users\Administrator\AppData\Roaming\Bitcoin\database 

ErrorFile=C:\Users\Administrator\AppData\Roaming\Bitcoin\db.log
Bound to [::]:8333
Bound to 0.0.0.0:8333
Loading block index...
LoadBlockIndex(): hashBestChain=0000000000000451ad20  height=193797  date=08/14/12 03:38:39
Verifying last 2500 blocks at level 1
 block index          158518ms
Loading wallet...
nFileVersion = 70100
 wallet                  858ms
Rescanning last 3 blocks (from block 193794)...
 rescan                   47ms
Loading addresses...
Loaded 12371 addresses from peers.dat  78ms
RandAddSeed() 164540 bytes
mapBlockIndex.size() = 193799
nBestHeight = 193797
setKeyPool.size() = 100
mapWallet.size() = 0
mapAddressBook.size() = 1
Done loading
send version message: version 60002, blocks=193797, us=0.0.0.0:0, them=0.0.0.0:0, peer=127.0.0.1:0
sending: version (100 bytes)
ThreadRPCServer started

```

**Tags:** bitcoind, windows

> **Comments:**
> **username_1**: A fix for this was pushed April 30, 2018. See https://github.com/bitcoin/bitcoin/blob/029d28a7aa5619973eb59fe445b9a4186c0c2a58/src/init.cpp#L914  

---

## 1 answers

### Answer by username_0 on 2012-12-13. Score: 1 | Accepted answer

Send the RPC Stop command:

```
cd "C:\Program Files (x86)\Bitcoin\daemon"
bitcoind stop

```

Output

```
ThreadRPCServer method=stop
Flush(false)
blkindex.dat refcount=0
blkindex.dat checkpoint
ThreadSocketHandler exited
blkindex.dat detach
ThreadMessageHandler exited
connection timeout
ThreadOpenConnections exited
ThreadDumpAddress exited

blkindex.dat closed
DBFlush(false) ended          219780ms
StopNode()
Flushed 12513 addresses to peers.dat  280ms
Flush(true)
DBFlush(true) ended               0ms
Bitcoin exited

```


---

