#36347 node: don't abort on invalid -dbcache in settings.json

ReviewabilityReviewsAgreementSize
#36347 0xShadowX node: don't abort on invalid -dbcache in settings.jsonReady2Strong2 + 12 tests
  • Prevent node crashes at startup when settings.json contains an invalid dbcache value
  • Ensure the node exits with a clear error message instead of aborting
  • Ready for review
  • Support with testing confirming the node exits with an error instead of aborting (8144225309)
  • Suggested adding a test case for valid integer settings, which the author added (Hamza1610)
  • Additional approval lacked rationale from an account with no project history (Hamza1610)
  • 2 lines added or modified outside tests
  • 12 lines added or modified in tests
  • 2 lines removed in total
  • 3 files, 1 commits
Utilities (logging, arguments, libraries)#25 of 59
P3 · bug fix
  • P3 because it fixes an unexpected startup crash from malformed configuration values
  • Node operators receive a helpful error message instead of an abrupt termination
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:

ReviewerTypeHarm, request, or questionStatusMust beAuthor repliedQuote
Hamza1610 (none)suggestion, correctnessadd a test case for a valid integer dbcache setting such as 4096accepted · fix pushed · accepted the fix in 47e3f36answeredyes2026-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

dossier JSON · extract JSON · model ledger, generated 2026-11-02T01:11, confidence high, input hash 21ad13374f944794
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