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

olasd added a subscriber: olasd.
olasd added inline comments.
swh/core/db/common.py
50

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

83

Same comment

This revision is now accepted and ready to land.Apr 9 2019, 5:33 PM
swh/core/db/common.py
50

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

This revision was automatically updated to reflect the committed changes.