-
Notifications
You must be signed in to change notification settings - Fork 879
fix registry._setup_database.lock remove issue and rollback the session after UNIQUE constraint failed exception #917
base: master
Are you sure you want to change the base?
Conversation
It will try to remove non-existing registry._setup_database.lock when search_backend setting to sqlalchemy Signed-off-by: Harrison Feng <[email protected]>
Here is the error message: InvalidRequestError: This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (IntegrityError) UNIQUE constraint failed: version.id u'INSERT INTO version (id) VALUES (?)' (1,) Signed-off-by: Harrison Feng <[email protected]>
I don't get it. https://github.com/harrisonfeng/docker-registry/blob/master/docker_registry/toolkit.py#L325 |
when search_backend sets to sqlalchemy, first start the container, then the container will stop automatically as that error happened. Actually, that error will happen every time. So I cannot run |
Ok. The better fix here would be to use lockfile (http://pythonhosted.org/lockfile/). Would you be willing to try this? |
@dmp42 why is lockfile a better solution? |
I'm not sure what @dmp42 is thinking, but as a general rule -- if you can let someone else do the tricky bits, the better. And lockfiles are notoriously tricky. |
Got it, thanks ;-) |
+1 if this change reduces crashes at least in the interim. Currently |
+1. First quick fix the broken part (done with this PR), then in a separate PR improve locking |
It will try to remove non-existing registry._setup_database.lock
when search_backend setting to sqlalchemy
Signed-off-by: Harrison Feng [email protected]