Make sure to close the database connection before forking in verbs

This prevents a bug with the postgres driver from breaking the verbs

Fixes https://jira.coreos.com/browse/QS-68
This commit is contained in:
Joseph Schorr 2017-12-04 16:33:24 -05:00
parent 4a5626e64b
commit 25248a8c35

View file

@ -250,6 +250,11 @@ def _repo_verb(namespace, repository, tag, verb, formatter, sign=False, checker=
logger.debug('Building and returning derived %s image %s', verb, derived_image.ref)
# Close the database connection before any process forking occurs. This is important because
# the Postgres driver does not react kindly to forking, so we need to make sure it is closed
# so that each process will get its own unique connection.
database.close_db_filter(None)
# Calculate a derived image ID.
derived_image_id = hashlib.sha256(repo_image.image_id + ':' + verb).hexdigest()