The __del__ method of DButils tries to close the database (and log this closure) as a convenience for the user. Unfortunately if the DButils 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:
Fixes DBRunner to clean up before exit
Adds documentation to DButils recommending cleaning up before exit, and also on runMe and ProcessQueue, since they hold references to DButils.
PR Checklist
[X] Pull request has descriptive title
[X] Pull request gives overview of changes
[X] New code has inline comments where necessary
[X] Any new modules, functions or classes have docstrings consistent with dbprocessing style
[X] (N/A) Major new functionality has appropriate Sphinx documentation
[X] (N/A) Added an entry to release notes if fixing a major bug or providing a major new feature
[X] (see below) New features and bug fixes should have unit tests
[X] (N/A) Relevant issues are linked in the description (use Closes # if this PR closes the issue, or some other reference, such as See # 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.
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.