Page MenuHomeSoftware Heritage

Explicitely give Db connections back to the pool.
ClosedPublic

Authored by vlorentz on Apr 9 2019, 4:56 PM.

Details

Summary

So they gracefully release the connection on error instead
of relying on reference-counting to call the Db's __del__
(which does not happen in Hypothesis tests) because a ref
to it is kept via the traceback object.

See also: D1381

Diff Detail

Repository
rDCORE Foundations and core functionalities
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

vlorentz created this revision.Apr 9 2019, 4:56 PM
olasd accepted this revision.Apr 9 2019, 5:33 PM
olasd added a subscriber: olasd.
olasd added inline comments.
swh/core/db/common.py
51

Can we guard this with an if hasattr(self, 'put_db') to avoid making other users of this (indexer, archiver) insta-buggy?

84

Same comment

This revision is now accepted and ready to land.Apr 9 2019, 5:33 PM
vlorentz added inline comments.Apr 9 2019, 5:35 PM
swh/core/db/common.py
51

No, because I removed BaseDb.__del__, so it would leak connections in prod.

This revision was automatically updated to reflect the committed changes.