Expected behavior
I expected for the program to keep executing, or to shutdown gracefully, after having displayed and/or logged messages/warnings telling me that write permissions are lacking on the involved filesystem resources. This can affect attempting to write to directories outside of the normal bitcoin data directory and/or blocks directory, as seen in my second example below. The nastier crashes are like the ones in the GUI settings that could happen concurrent to data modification. Those could lead to data corruption when files are not flushed, and/or data gets out of synch.
Actual behavior
The program logged a runaway exception and immediately aborted.
To reproduce
This can be reproduced in multiple ways since there are many references to fs::create_directories
. Also, crashes can result from restrictive umask
settings too since some calls attempt to create directories multiple levels deep.
Here are two easy ways:
- bitcoind “-blocksdir not writable”
- start with the command line:
mkdir /tmp/blocks && chmod 0500 /tmp/blocks && ./src/bitcoind -blocksdir=/tmp/blocks
- the program will immediately crash with this logged in the console:
- start with the command line:
0************************
1EXCEPTION: NSt10filesystem7__cxx1116filesystem_errorE
2filesystem error: cannot create directories: Permission denied [/tmp/blocks/blocks]
3bitcoin in AppInit()
- bitcoin-qt “Start Bitcoin Core on system login
- start with the command line:
mkdir -p /tmp/btc && mkdir -p /tmp/crash && chmod 0500 /tmp/crash && XDG_CONFIG_HOME=/tmp/crash ./src/qt/bitcoin-qt -debug -datadir=/tmp/btc -connect=0
- in the GUI go to the
Settings
menu and selectOptions...
- check
Start Bitcoin Core on system login
- click OK. you will be presented with the exception as:
- the console will show:
- start with the command line:
0************************
1EXCEPTION: NSt10filesystem7__cxx1116filesystem_errorE
2filesystem error: cannot create directories: Permission denied [/tmp/crash/autostart]
3bitcoin in Runaway exception
4
5bitcoin-qt: ./checkqueue.h:204: CCheckQueue<T>::~CCheckQueue() [with T = CScriptCheck]: Assertion `m_worker_threads.empty()' failed.
6Aborted (core dumped)
System information
This affects current master branch as of at least be7a5f2fc400e7a3ef72dedbdcf49dd6c96d4f9e. Tested on Ubuntu 21.10.