[wallet] Close DB on error.#11017
Merged
jonasschnelli merged 1 commit intobitcoin:masterfrom Aug 15, 2017
Merged
Conversation
Contributor
|
Concept ACK! Nice find 👍 |
Member
|
utACK 03bc719 |
Contributor
|
utACK 03bc719 |
laanwj
reviewed
Aug 10, 2017
| } else { | ||
| pdbCopy->close(0); | ||
| } | ||
| delete pdbCopy; |
Member
There was a problem hiding this comment.
Shouldn't it always close pdbCopy before deleting it, not just on failure?
Contributor
Author
Contributor
Author
|
@promag I ran bitcoind through Instruments on a mac, and noticed I think 40k leaks (not 40 kb, 40 thousand occurrences..) on startup. One of the traces for leaked memory was the DB open call. |
Contributor
|
utACK 03bc719 |
jonasschnelli
added a commit
that referenced
this pull request
Aug 15, 2017
03bc719 [wallet] Close DB on error. (Karl-Johan Alm) Pull request description: This PR intends to plug some leaks. It specifically implements adherence to the requirement in BDB to close a handle which failed to open (https://docs.oracle.com/cd/E17276_01/html/api_reference/C/dbopen.html): > The `DB->open()` method returns a non-zero error value on failure and 0 on success. If `DB->open()` fails, the `DB->close()` method must be called to discard the DB handle. Tree-SHA512: cc1f2b925ef3fd6de785f62108fbc79454443397f80707762acbc56757841d2c32b69c0234f87805571aa40c486da31f315ca4c607a2c7d1c97c82a01301e2a6
maflcko
pushed a commit
to maflcko/bitcoin-core
that referenced
this pull request
Oct 3, 2017
Github-Pull: bitcoin#11017 Rebased-From: 03bc719
schancel
pushed a commit
to schancel/bitcoin-abc
that referenced
this pull request
Apr 19, 2019
Summary: [wallet] Close DB on error. Backport of Core PR 11017 bitcoin/bitcoin#11017 Completes T606 Test Plan: make check test_runner.py Sanity check open and close (both by exiting and by ctrl-C interrupt) bitcoin-qt Reviewers: jasonbcox, deadalnix, Fabien, O1 Bitcoin ABC, #bitcoin_abc Reviewed By: jasonbcox, O1 Bitcoin ABC, #bitcoin_abc Differential Revision: https://reviews.bitcoinabc.org/D2807
proteanx
pushed a commit
to devaultcrypto/devault
that referenced
this pull request
Apr 26, 2019
Summary: [wallet] Close DB on error. Backport of Core PR 11017 bitcoin/bitcoin#11017 Completes T606 Test Plan: make check test_runner.py Sanity check open and close (both by exiting and by ctrl-C interrupt) bitcoin-qt Reviewers: jasonbcox, deadalnix, Fabien, O1 Bitcoin ABC, #bitcoin_abc Reviewed By: jasonbcox, O1 Bitcoin ABC, #bitcoin_abc Differential Revision: https://reviews.bitcoinabc.org/D2807
Greg-Griffith
added a commit
to Greg-Griffith/eccoin
that referenced
this pull request
May 1, 2019
codablock
pushed a commit
to codablock/dash
that referenced
this pull request
Sep 25, 2019
03bc719 [wallet] Close DB on error. (Karl-Johan Alm) Pull request description: This PR intends to plug some leaks. It specifically implements adherence to the requirement in BDB to close a handle which failed to open (https://docs.oracle.com/cd/E17276_01/html/api_reference/C/dbopen.html): > The `DB->open()` method returns a non-zero error value on failure and 0 on success. If `DB->open()` fails, the `DB->close()` method must be called to discard the DB handle. Tree-SHA512: cc1f2b925ef3fd6de785f62108fbc79454443397f80707762acbc56757841d2c32b69c0234f87805571aa40c486da31f315ca4c607a2c7d1c97c82a01301e2a6
furszy
added a commit
to PIVX-Project/PIVX
that referenced
this pull request
Feb 12, 2021
0c4b20f [Wallet] Close DB on error (Fuzzbawls) Pull request description: Coming from bitcoin#11017 > This PR intends to plug some leaks. It specifically implements adherence to the requirement in BDB to close a handle which failed to open (https://docs.oracle.com/cd/E17276_01/html/api_reference/C/dbopen.html): > > > The DB->open() method returns a non-zero error value on failure and 0 on success. If DB->open() fails, the DB->close() method > > must be called to discard the DB handle. ACKs for top commit: random-zebra: utACK 0c4b20f furszy: utACK 0c4b20f Tree-SHA512: 826e1eb651b93b62e7e01701b7d233902ddcf6a995d09e020194523ef3834162b397e186477e31f3e0b1a11bc80483635f7bc731907e9367ff7f38a3ddc782ae
barton2526
added a commit
to barton2526/Gridcoin-Research
that referenced
this pull request
Jul 12, 2021
barton2526
added a commit
to barton2526/Gridcoin-Research
that referenced
this pull request
Jul 12, 2021
barton2526
added a commit
to barton2526/Gridcoin-Research
that referenced
this pull request
Jul 12, 2021
Ref: bitcoin/bitcoin#11017 I thought better and moved the trivial to another PR. This will be exclusively the DB change because it is a regression risk.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR intends to plug some leaks. It specifically implements adherence to the requirement in BDB to close a handle which failed to open (https://docs.oracle.com/cd/E17276_01/html/api_reference/C/dbopen.html):