-
Bug
-
Resolution: Done
-
Critical
-
quay-v3.11.0
-
False
-
None
-
False
-
-
Description:
This is an issue found in Quay 3.11, after create autoprunepolicy at Organization level, and create autoprunepolicy for the 1st image repo under target Organization successfully, trying to create autoprunepolicy for the 2nd image repo hit 500 internal error, checked Quay APP Logs, get error "DETAIL: Key (namespace_id)=(8) already exists.", pls review this issue, see attached Quay APP POD logs quay311_app_pod2_20240305.logs
Quay: quay-operator-bundle-container-v3.11.0-21
Quay 3.11 create autoprune policy at image repo level hit 500 internal error:
Quay Logs:
gunicorn-web stdout | 2024-03-05 04:16:59,489 [235] [ERROR] [gunicorn.error] Error handling request /api/v1/repository/testautoprunepolicy/testdemo2/autoprunepolicy/ gunicorn-web stdout | Traceback (most recent call last): gunicorn-web stdout | File "/app/lib/python3.9/site-packages/peewee.py", line 3057, in execute_sql gunicorn-web stdout | cursor.execute(sql, params or ()) gunicorn-web stdout | psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "repositoryautoprunepolicy_namespace_id" gunicorn-web stdout | DETAIL: Key (namespace_id)=(8) already exists. gunicorn-web stdout | During handling of the above exception, another exception occurred: gunicorn-web stdout | Traceback (most recent call last): gunicorn-web stdout | File "/app/lib/python3.9/site-packages/gunicorn/workers/base_async.py", line 55, in handle gunicorn-web stdout | self.handle_request(listener_name, req, client, addr) gunicorn-web stdout | File "/app/lib/python3.9/site-packages/gunicorn/workers/ggevent.py", line 128, in handle_request gunicorn-web stdout | super().handle_request(listener_name, req, sock, addr) gunicorn-web stdout | File "/app/lib/python3.9/site-packages/gunicorn/workers/base_async.py", line 108, in handle_request gunicorn-web stdout | respiter = self.wsgi(environ, resp.start_response) gunicorn-web stdout | File "/app/lib/python3.9/site-packages/flask/app.py", line 2213, in __call__ gunicorn-web stdout | return self.wsgi_app(environ, start_response) gunicorn-web stdout | File "/app/lib/python3.9/site-packages/werkzeug/middleware/proxy_fix.py", line 182, in __call__ gunicorn-web stdout | return self.app(environ, start_response) gunicorn-web stdout | File "/app/lib/python3.9/site-packages/flask/app.py", line 2193, in wsgi_app gunicorn-web stdout | response = self.handle_exception(e) gunicorn-web stdout | File "/app/lib/python3.9/site-packages/flask_restful/__init__.py", line 298, in error_router gunicorn-web stdout | return original_handler(e) gunicorn-web stdout | File "/app/lib/python3.9/site-packages/flask/app.py", line 2190, in wsgi_app gunicorn-web stdout | response = self.full_dispatch_request() gunicorn-web stdout | File "/app/lib/python3.9/site-packages/flask/app.py", line 1486, in full_dispatch_request gunicorn-web stdout | rv = self.handle_user_exception(e) gunicorn-web stdout | File "/app/lib/python3.9/site-packages/flask_restful/__init__.py", line 298, in error_router gunicorn-web stdout | return original_handler(e) gunicorn-web stdout | File "/app/lib/python3.9/site-packages/flask/app.py", line 1484, in full_dispatch_request gunicorn-web stdout | rv = self.dispatch_request() gunicorn-web stdout | File "/app/lib/python3.9/site-packages/flask/app.py", line 1469, in dispatch_request gunicorn-web stdout | return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) gunicorn-web stdout | File "/quay-registry/endpoints/decorators.py", line 285, in wrapper gunicorn-web stdout | return func(*args, **kwargs) gunicorn-web stdout | File "/quay-registry/auth/decorators.py", line 68, in wrapper gunicorn-web stdout | return func(*args, **kwargs) gunicorn-web stdout | File "/quay-registry/util/request.py", line 64, in wrapper gunicorn-web stdout | return decorator(func)(*args, **kwargs) gunicorn-web stdout | File "/app/lib/python3.9/site-packages/flask_restful/utils/cors.py", line 35, in wrapped_function gunicorn-web stdout | resp = make_response(f(*args, **kwargs)) gunicorn-web stdout | File "/quay-registry/endpoints/csrf.py", line 71, in wrapper gunicorn-web stdout | resp = func(*args, **kwargs) gunicorn-web stdout | File "/app/lib/python3.9/site-packages/flask_restful/__init__.py", line 489, in wrapper gunicorn-web stdout | resp = resource(*args, **kwargs) gunicorn-web stdout | File "/app/lib/python3.9/site-packages/flask/views.py", line 109, in view gunicorn-web stdout | return current_app.ensure_sync(self.dispatch_request)(**kwargs) gunicorn-web stdout | File "/app/lib/python3.9/site-packages/flask_restful/__init__.py", line 604, in dispatch_request gunicorn-web stdout | resp = meth(*args, **kwargs) gunicorn-web stdout | File "/quay-registry/endpoints/decorators.py", line 189, in wrapper gunicorn-web stdout | return func(*args, **kwargs) gunicorn-web stdout | File "/quay-registry/endpoints/api/__init__.py", line 245, in wrapper gunicorn-web stdout | return func(namespace, repository, *args, **kwargs) gunicorn-web stdout | File "/quay-registry/endpoints/decorators.py", line 164, in wrapper gunicorn-web stdout | return func(*args, **kwargs) gunicorn-web stdout | File "/quay-registry/endpoints/api/__init__.py", line 340, in wrapped gunicorn-web stdout | return func(self, namespace, repository, *args, **kwargs) gunicorn-web stdout | File "/quay-registry/endpoints/api/__init__.py", line 573, in wrapped gunicorn-web stdout | return func(self, *args, **kwargs) gunicorn-web stdout | File "/quay-registry/endpoints/api/policy.py", line 312, in post gunicorn-web stdout | policy = model.autoprune.create_repository_autoprune_policy( gunicorn-web stdout | File "/quay-registry/data/model/autoprune.py", line 264, in create_repository_autoprune_policy gunicorn-web stdout | new_policy = RepositoryAutoPrunePolicyTable.create( gunicorn-web stdout | File "/app/lib/python3.9/site-packages/peewee.py", line 6235, in create gunicorn-web stdout | inst.save(force_insert=True) gunicorn-web stdout | File "/app/lib/python3.9/site-packages/peewee.py", line 6433, in save gunicorn-web stdout | pk = self.insert(**field_dict).execute() gunicorn-web stdout | File "/app/lib/python3.9/site-packages/peewee.py", line 1845, in inner gunicorn-web stdout | return method(self, database, *args, **kwargs) gunicorn-web stdout | File "/app/lib/python3.9/site-packages/peewee.py", line 1916, in execute gunicorn-web stdout | return self._execute(database) gunicorn-web stdout | File "/app/lib/python3.9/site-packages/peewee.py", line 2665, in _execute gunicorn-web stdout | return super(Insert, self)._execute(database) gunicorn-web stdout | File "/app/lib/python3.9/site-packages/peewee.py", line 2398, in _execute gunicorn-web stdout | cursor = self.execute_returning(database) gunicorn-web stdout | File "/app/lib/python3.9/site-packages/peewee.py", line 2405, in execute_returning gunicorn-web stdout | cursor = database.execute(self) gunicorn-web stdout | File "/app/lib/python3.9/site-packages/peewee.py", line 3070, in execute gunicorn-web stdout | return self.execute_sql(sql, params, commit=commit) gunicorn-web stdout | File "/quay-registry/data/database.py", line 228, in execute_sql gunicorn-web stdout | cursor = super(RetryOperationalError, self).execute_sql(sql, params, commit) gunicorn-web stdout | File "/app/lib/python3.9/site-packages/peewee.py", line 3064, in execute_sql gunicorn-web stdout | self.commit() gunicorn-web stdout | File "/app/lib/python3.9/site-packages/peewee.py", line 2831, in __exit__ gunicorn-web stdout | reraise(new_type, new_type(exc_value, *exc_args), traceback) gunicorn-web stdout | File "/app/lib/python3.9/site-packages/peewee.py", line 183, in reraise gunicorn-web stdout | raise value.with_traceback(tb) gunicorn-web stdout | File "/app/lib/python3.9/site-packages/peewee.py", line 3057, in execute_sql gunicorn-web stdout | cursor.execute(sql, params or ()) gunicorn-web stdout | peewee.IntegrityError: duplicate key value violates unique constraint "repositoryautoprunepolicy_namespace_id" gunicorn-web stdout | DETAIL: Key (namespace_id)=(8) already exists. gunicorn-web stdout | 2024-03-05 04:16:59,491 [235] [INFO] [gunicorn.access] - - [05/Mar/2024:04:16:59 +0000] "POST /api/v1/repository/testautoprunepolicy/testdemo2/autoprunepolicy/ HTTP/1.0" 500 0 "-" "-"