Close DBrunner db on exit; document the need to close #101
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.
The
__del__
method ofDButils
tries to close the database (and log this closure) as a convenience for the user. Unfortunately if theDButils
object is still hanging around at program termination, it will be deleted then, and the Python interpreter may have already torn down the logger, and potentially other facilities needed to close the database. The order in which things are torn down is not guaranteed.This manifests in
DBRunner.py
since it fails to close the database. I've managed to whack-a-mole away most of the other instances but missed that one.This PR:
DButils
recommending cleaning up before exit, and also onrunMe
andProcessQueue
, since they hold references toDButils
.PR Checklist
Closes #
if this PR closes the issue, or some other reference, such asSee #
if it is related in some other way)As this bug is nondeterministic, it can't really be unit tested. Similar treatments have cleared up issues in other cases.