spacepy / dbprocessing

Automated processing controller for heliophysics data
5 stars 4 forks source link

Close DBrunner db on exit; document the need to close #101

Closed jtniehof closed 2 years ago

jtniehof commented 2 years ago

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:

PR Checklist

As this bug is nondeterministic, it can't really be unit tested. Similar treatments have cleared up issues in other cases.

balarsen commented 2 years ago

Good warnings, python is annoying in these.