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

pull 0xShadowX wants to merge 1 commits into bitcoin:master from 0xShadowX:fix-dbcache-settings-abort changing 3 files +14 −2
  1. 0xShadowX commented at 5:16 PM on September 26, 2026: none

    LogOversizedDbCache (added in #33333) is noexcept, but it reads -dbcache through CalculateDbCacheBytes -> GetIntArg. GetIntArg throws when settings.json has a number that isn't an integer or doesn't fit in int64, e.g. {"dbcache": 4096.5}. The exception hits the noexcept boundary and bitcoind aborts during startup:

    libc++abi: terminating due to uncaught exception of type std::runtime_error: JSON integer out of range
    

    This removes noexcept. The exception now reaches the handler in AppInit, and the node exits with status 1 and an error message instead of aborting:

    EXCEPTION: St13runtime_error
    JSON integer out of range
    bitcoin in AppInit()
    

    The added case in feature_settings.py writes {"dbcache": 4096.5} to settings.json and checks that startup fails with that message from AppInit.

  2. DrahtBot commented at 5:16 PM on September 26, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    Stale ACK Hamza1610

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  3. 8144225309 commented at 9:50 PM on October 5, 2026: contributor

    ACK 75e297d79101f817b7b550747c8e6434e619d2f5

    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.

  4. in test/functional/feature_settings.py:89 in 75e297d791 outdated
      84 | @@ -85,6 +85,11 @@ def run_test(self):
      85 |              fp.write('{"key": 1, "key": 2}')
      86 |          node.assert_start_raises_init_error(expected_msg='Found duplicate key key in settings file', match=ErrorMatch.PARTIAL_REGEX)
      87 |  
      88 | +        # Test a non-integer dbcache value is reported by AppInit instead of aborting
      89 | +        with settings.open("w") as fp:
    


    Hamza1610 commented at 7:20 PM on October 7, 2026:

    I would suggest that there is test for integer eg. 4096. makes


    0xShadowX commented at 8:49 PM on October 7, 2026:

    Added a test with dbcache: 4096 in 47e3f3633e: the node starts and the value is read from the settings file. I put it before the non-integer case so the later -nosettings checks still see an invalid settings file.

  5. Hamza1610 commented at 7:22 PM on October 7, 2026: none

    Concept ACK

  6. 0xShadowX force-pushed on Oct 7, 2026
  7. Hamza1610 commented at 12:53 PM on October 8, 2026: none

    ACK 47e3f36

  8. sedited requested review from l0rinc on Oct 8, 2026
  9. DrahtBot added the label CI failed on Oct 9, 2026
  10. maflcko commented at 4:44 PM on October 13, 2026: member

    The ci fails. Can this be closed, or are you still working on this?

  11. node: don't abort on invalid -dbcache in settings.json
    LogOversizedDbCache is noexcept, but it reads -dbcache through
    GetIntArg, which throws when settings.json holds a number that is not
    an integer or doesn't fit in int64 (e.g. {"dbcache": 4096.5}). The
    exception hits the noexcept boundary and std::terminate aborts
    bitcoind during startup.
    
    Remove noexcept so the exception reaches AppInit like it does for other
    integer settings, and the node exits with an error message instead of
    aborting.
    2e00693220
  12. 0xShadowX force-pushed on Oct 13, 2026
  13. 0xShadowX commented at 8:32 PM on October 13, 2026: none

    The failure was in the new test, not the fix: {"dbcache": 4096} triggers the oversized-dbcache warning on the 7 GiB macOS runner, and the unexpected stderr fails stop_node. Switched the test values to 300 / 300.5, which stay below the 450 MiB floor of ShouldWarnOversizedDbCache, so the warning can't fire on any machine. Still interested in getting this in.

  14. DrahtBot removed the label CI failed on Oct 20, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-10-25 02:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me