-
Notifications
You must be signed in to change notification settings - Fork 38.7k
[wallet] Close DB on error. #11017
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[wallet] Close DB on error. #11017
Conversation
|
Concept ACK! Nice find 👍 |
gmaxwell
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
|
utACK 03bc719 |
|
utACK 03bc719 |
| } else { | ||
| pdbCopy->close(0); | ||
| } | ||
| delete pdbCopy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it always close pdbCopy before deleting it, not just on failure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
promag
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 03bc719.
BTW, how did you catch this?
|
@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. |
|
utACK 03bc719 |
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
Github-Pull: bitcoin#11017 Rebased-From: 03bc719
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
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
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
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
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 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):