wallet: Releases dangling files on BerkeleyEnvironment::Close #15297

pull promag wants to merge 3 commits into bitcoin:master from promag:2019-01-close-dbenv-files changing 4 files +22 −0
  1. promag commented at 12:33 AM on January 31, 2019: member

    This PR closes db.log and removes .walletlock files when BerkeleyEnvironment is closed.

    Fixes #15291 (comment).

  2. promag cross-referenced this on Jan 31, 2019 from issue Free BerkeleyEnvironment instances when not in use by ryanofsky
  3. gmaxwell commented at 12:39 AM on January 31, 2019: contributor

    Concept ACK

  4. fanquake added the label Wallet on Jan 31, 2019
  5. promag commented at 1:16 AM on January 31, 2019: member

    Please add to 0.18 milestone.

  6. fanquake added this to the milestone 0.18.0 on Jan 31, 2019
  7. in src/wallet/db.cpp:131 in 9eb2077e1e outdated
     125 | @@ -126,6 +126,10 @@ void BerkeleyEnvironment::Close()
     126 |          }
     127 |      }
     128 |  
     129 | +    FILE* error_file = nullptr;
     130 | +    dbenv->get_errfile(&error_file);
     131 | +    if (error_file) fclose(error_file);
    


    promag commented at 7:42 AM on January 31, 2019:

    Maybe this should be after dbenv->close(0).

  8. promag force-pushed on Jan 31, 2019
  9. promag cross-referenced this on Jan 31, 2019 from issue Bitcoin-core multiwallets limited to about 300 loads by fscemama
  10. MarcoFalke commented at 5:16 PM on January 31, 2019: member

    Needs rebase

  11. promag force-pushed on Jan 31, 2019
  12. promag commented at 5:40 PM on January 31, 2019: member

    Rebased.

  13. fanquake added this to the "In progress" column in a project

  14. practicalswift commented at 8:01 PM on February 1, 2019: contributor

    Concept ACK

  15. promag force-pushed on Feb 3, 2019
  16. wallet: Close dbenv error file db.log
    The error file db.log is opened by BerkeleyEnvironment instance and
    should be closed after dbenv is closed.
    8602a1e6ae
  17. wallet: Close wallet env lock file
    Close .walletlock file when a BerkeleyEnvironment is deleted.
    2f8b8f479b
  18. promag force-pushed on Feb 4, 2019
  19. ryanofsky approved
  20. ryanofsky commented at 6:16 PM on February 4, 2019: contributor

    utACK 2f8b8f479bb43729ca2ff40929e8463347b0b7b4. Nice cleanup!

  21. qa: Test .walletlock file is closed d3bf3b930d
  22. promag commented at 6:53 PM on February 4, 2019: member

    Thanks @ryanofsky, pushed a test that fails without this PR.

  23. ryanofsky approved
  24. ryanofsky commented at 7:39 PM on February 4, 2019: contributor

    utACK d3bf3b930d34da7d121ae35b4fb75865ed73208c. Just added test since the previous review.

  25. laanwj commented at 7:49 PM on February 4, 2019: member

    utACK 2f8b8f479bb43729ca2ff40929e8463347b0b7b4

  26. promag cross-referenced this on Feb 5, 2019 from issue Crash: BerkeleyEnvironment::VerifyResult upon `loadwallet` by bitcoinhodler
  27. fanquake commented at 4:23 PM on February 5, 2019: member

    utACK d3bf3b9

    master (fc21bb4):

    src/qt/bitcoin-qt
    
    lsof -p 56700 | grep wallet
    bitcoin-q 56700 michael   24u     REG                1,4        0  4556196 /Users/michael/Library/Application Support/Bitcoin/wallets/.walletlock
    bitcoin-q 56700 michael   25w     REG                1,4        0  4556198 /Users/michael/Library/Application Support/Bitcoin/wallets/db.log
    bitcoin-q 56700 michael   33u     REG                1,4  1048576 26847564 /Users/michael/Library/Application Support/Bitcoin/wallets/database/log.0000000001
    bitcoin-q 56700 michael   39w     REG                1,4        0  4556198 /Users/michael/Library/Application Support/Bitcoin/wallets/db.log
    
    src/bitcoin-cli unloadwallet ""
    
    lsof -p 56700 | grep wallet
    bitcoin-q 56700 michael   24u     REG                1,4        0  4556196 /Users/michael/Library/Application Support/Bitcoin/wallets/.walletlock
    bitcoin-q 56700 michael   25w     REG                1,4        0  4556198 /Users/michael/Library/Application Support/Bitcoin/wallets/db.log
    bitcoin-q 56700 michael   39w     REG                1,4        0  4556198 /Users/michael/Library/Application Support/Bitcoin/wallets/db.log
    

    This PR:

    src/qt/bitcoin-qt
    
    lsof -p 54793 | grep wallet
    bitcoin-q 54793 michael   36u      REG                1,4        0  4556196 /Users/michael/Library/Application Support/Bitcoin/wallets/.walletlock
    bitcoin-q 54793 michael   37w      REG                1,4        0  4556198 /Users/michael/Library/Application Support/Bitcoin/wallets/db.log
    bitcoin-q 54793 michael   38u      REG                1,4  1048576 26847564 /Users/michael/Library/Application Support/Bitcoin/wallets/database/log.0000000001
    
    src/bitcoin-cli unloadwallet ""
    
    lsof -p 54793 | grep wallet
    
  28. meshcollider merged this on Feb 5, 2019
  29. meshcollider closed this on Feb 5, 2019

  30. meshcollider referenced this in commit 30e799a5f7 on Feb 5, 2019
  31. jnewbery moved this from the "In progress" to the "Done" column in a project

  32. Kexkey cross-referenced this on Feb 7, 2019 from issue On createwallet: BerkeleyBatch: Error 2, can't open database wallet.dat by Kexkey
  33. promag deleted the branch on Feb 11, 2019
  34. promag commented at 8:21 PM on February 11, 2019: member

    Should be backport?

  35. fanquake added the label Needs backport on Feb 11, 2019
  36. achow101 cross-referenced this on Mar 4, 2019 from issue RPC unloadwallet does not close wallet files. by AliceOJJm
  37. MarcoFalke removed this from the milestone 0.18.0 on Mar 6, 2019
  38. MarcoFalke added this to the milestone 0.17.2 on Mar 6, 2019
  39. promag referenced this in commit 5e495fe22a on Mar 10, 2019
  40. promag referenced this in commit 0f94e32cbb on Mar 10, 2019
  41. promag referenced this in commit 88f55c5578 on Mar 10, 2019
  42. promag cross-referenced this on Mar 10, 2019 from issue 0.17: Backport 15297 by promag
  43. fanquake removed the label Needs backport on Mar 11, 2019
  44. fanquake commented at 12:51 AM on March 11, 2019: member

    Being backported in #15575.

  45. promag referenced this in commit 06f44c53e1 on Mar 11, 2019
  46. promag referenced this in commit 7097ead059 on Mar 11, 2019
  47. promag referenced this in commit 84e8adbf3e on Mar 11, 2019
  48. promag referenced this in commit 592a095883 on Mar 11, 2019
  49. promag referenced this in commit 662f8f81fa on Mar 11, 2019
  50. promag referenced this in commit 940109dabf on Mar 11, 2019
  51. promag referenced this in commit 22cdb6cf59 on Mar 12, 2019
  52. promag referenced this in commit 2e9e904a5d on Mar 12, 2019
  53. promag referenced this in commit fe95f84542 on Mar 12, 2019
  54. laanwj referenced this in commit 6cf81b01b4 on Mar 20, 2019
  55. sidhujag referenced this in commit fa1e446245 on Mar 28, 2019
  56. sidhujag referenced this in commit dcca439cce on Mar 28, 2019
  57. sidhujag referenced this in commit 0be38b1efc on Mar 28, 2019
  58. sidhujag referenced this in commit 3ee64a0aa7 on Mar 28, 2019
  59. uhliksk referenced this in commit 22f2a130cc on Apr 21, 2019
  60. uhliksk referenced this in commit 39e8c710e1 on Apr 21, 2019
  61. uhliksk referenced this in commit 9634824ffc on Apr 21, 2019
  62. Rishabh42 referenced this in commit ce3547fae6 on Apr 22, 2019
  63. uhliksk referenced this in commit f509f52a62 on May 1, 2019
  64. uhliksk referenced this in commit 325f960ecc on May 1, 2019
  65. uhliksk referenced this in commit 3da7701426 on May 1, 2019
  66. linuxsh2 referenced this in commit 38b7c6cc7f on Jul 30, 2021
  67. linuxsh2 referenced this in commit 7195f7cdf7 on Aug 3, 2021
  68. bitcoin locked this on Dec 16, 2021

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-05-20 06:54 UTC