#36347 node: don't abort on invalid -dbcache in settings.json
| Reviewability | Reviews | Agreement | Size | ||||
|---|---|---|---|---|---|---|---|
| #36347 node: don't abort on invalid -dbcache in settings.json | Ready | 2 | Strong | 2 + 12 tests | |||
|
|
|
|
| |||
Reviewability: ReadyStalePaused Agreement: StrongPositivePositive w/ caveatsNeutralMildDisputedBlockedCrickets Reviews: current code-review ACKs, then (+stale ACKs) and -NACKs; greener = more ACKs. Size: lines added or modified outside tests, then in tests; greener = smaller. | |||||||
Goal
Removes the `noexcept` specifier from `LogOversizedDbCache` and adds functional test cases for integer and invalid non-integer `dbcache` values in `settings.json`. This allows parse exceptions from `GetIntArg` to propagate up to `AppInit`'s top-level exception handler, causing the node to exit with an informative error rather than aborting via `std::terminate`.
Problem: If `settings.json` contains a non-integer or out-of-range number for `dbcache` (such as `300.5`), `GetIntArg` throws `std::runtime_error`. Because `LogOversizedDbCache` was marked `noexcept`, this exception triggers `std::terminate` during startup instead of being handled by `AppInit`.
Evidence of importance:
- PR description and commit note uncaught exception crash during startup: 'libc++abi: terminating due to uncaught exception of type std::runtime_error: JSON integer out of range'
- The diff directly corroborates the mechanism: `LogOversizedDbCache` calls `CalculateDbCacheBytes` which calls `GetIntArg`, while the function was declared `noexcept`.
Risk of a mistake: low (tests). Only removes a noexcept specifier on an initialization logging helper to allow standard startup error handling to catch argument parse errors.
Changed since the previous assessment: The functional test in `feature_settings.py` was updated or rebased (testing both valid `300` and invalid `300.5` instead of `4096.5`).
Reviewability
Ready
Nothing known that would invalidate a review now.
Waiting on (from the thread read):
- nothing: no pending items or actions
Agreement
Strong
substantive support, no open objection (8144225309)
Thread notes: Added re-ACK from 8144225309. Hamza1610 also re-ACKed, but without rationale and with no project contribution history, so it was not recorded as a support entry.
Objections, suggestions, and questions:
| Reviewer | Type | Harm, request, or question | Status | Must be | Author replied | Quote |
|---|---|---|---|---|---|---|
| Hamza1610 (none) | suggestion, correctness | add a test case for a valid integer dbcache setting such as 4096 | accepted · fix pushed · accepted the fix in 47e3f36 | answered | yes | 2026-10-07: 'I would suggest that there is test for integer eg. 4096' Status from: 2026-10-08: Hamza1610: 'ACK [47e3f36](https://github.com/bitcoin/bitcoin/pull/36347/commits/47e3f3633e464c701dc4c4038646fee266d5c1a5)' |
Support:
- 8144225309 (contributor) (ACK, 2026-10-05) [both: AppInit, settings.json]: On master a non-integer `dbcache` in settings.json aborts the node at startup. This change makes it exit with an error through `AppInit`, and the new test fails without it.
- 8144225309 (contributor) (ACK, 2026-11-01): (no reason given) [not substantive]
Participants:
- 8144225309 (contributor, support, 2 statements 2026-10-05 to 2026-11-01): ACKed with testing and explanation of startup behavior; re-ACKed commit 2e00693
- Hamza1610 (none, support, 4 statements 2026-10-07 to 2026-11-01): re-ACKed commit 2e00693; suggested adding a test for a valid integer dbcache value
- maflcko (member, neutral, 1 statements 2026-10-13 to 2026-10-13): asked if the PR can be closed due to CI failure or if the author is still working on it
Files
12 lines under test/bench/ci.
- test/functional/feature_settings.py +12/-0
- src/node/caches.cpp +1/-1
- src/node/caches.h +1/-1
Card
The short text the ranking pass compares across PRs.
Removes the noexcept specifier from LogOversizedDbCache so invalid dbcache values in settings.json produce a clean startup exit instead of a process abort. When settings.json contains a non-integer dbcache value, GetIntArg throws std::runtime_error, which hit the noexcept boundary and caused std::terminate to abort bitcoind during startup. Removing noexcept allows the exception to propagate to the AppInit handler, printing an informative error message and exiting with status 1.
Data
thread read through 2026-11-01 (9 statements), head 2e00693220
labels: none
Categories
Utilities (logging, arguments, libraries)
P3 · bug fix
Fixes a startup crash caused by `std::terminate` when `settings.json` contains an invalid `dbcache`. Removing `noexcept` from `LogOversizedDbCache` allows the parse error to reach `AppInit`'s top-level exception handler and produce a clear error message instead of an abort.
Membership: Modifies configuration and startup error handling in `src/node/caches.cpp` when parsing settings from `settings.json`.
Factors: security/stability 1, bug 1, performance 0, user value 1, leverage 0