Uploaded image for project: 'Project Quay'
  1. Project Quay
  2. PROJQUAY-3737

Quay 3.7.0 hit 500 error page after run take ownership of existing organization with superuser

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • None
    • quay-v3.7.0
    • quay
    • False
    • None
    • False

      Description:

      This is an issue found when take ownership of existing organization on Superuser admin panel, the results is Quay hit 500 error page, after checked app POD logs, get error message "gunicorn-web stdout | peewee.IntegrityError: duplicate key value violates unique constraint "repositorysize_repository_id", see attached logs quay370_app_pod1.logs 

      Quay Image: quay-operator-bundle-container-v3.7.0-103

      Take ownership of existing organization on superuser admin panel:

      Quay hit 500 error page after take ownership of existing organization:

      gunicorn-web stdout | 2022-04-29 02:40:24,023 [227] [ERROR] [gunicorn.error] Error handling request /api/v1/repository?last_modified=true&namespace=qateam&popularity=true&public=false&quota=true&state=true
      gunicorn-web stdout | Traceback (most recent call last):
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/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 "repositorysize_repository_id"
      gunicorn-web stdout | DETAIL:  Key (repository_id)=(1) 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 "/usr/local/lib/python3.8/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 "/usr/local/lib/python3.8/site-packages/gunicorn/workers/ggevent.py", line 127, in handle_request
      gunicorn-web stdout |     super().handle_request(listener_name, req, sock, addr)
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/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 "/usr/local/lib/python3.8/site-packages/flask/app.py", line 2463, in __call__
      gunicorn-web stdout |     return self.wsgi_app(environ, start_response)
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/site-packages/werkzeug/middleware/proxy_fix.py", line 232, in __call__
      gunicorn-web stdout |     return self.app(environ, start_response)
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 2449, in wsgi_app
      gunicorn-web stdout |     response = self.handle_exception(e)
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/site-packages/flask_restful/__init__.py", line 269, in error_router
      gunicorn-web stdout |     return original_handler(e)
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1866, in handle_exception
      gunicorn-web stdout |     reraise(exc_type, exc_value, tb)
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/site-packages/flask/_compat.py", line 38, in reraise
      gunicorn-web stdout |     raise value.with_traceback(tb)
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 2446, in wsgi_app
      gunicorn-web stdout |     response = self.full_dispatch_request()
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1951, in full_dispatch_request
      gunicorn-web stdout |     rv = self.handle_user_exception(e)
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/site-packages/flask_restful/__init__.py", line 269, in error_router
      gunicorn-web stdout |     return original_handler(e)
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1820, in handle_user_exception
      gunicorn-web stdout |     reraise(exc_type, exc_value, tb)
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/site-packages/flask/_compat.py", line 38, in reraise
      gunicorn-web stdout |     raise value.with_traceback(tb)
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1949, in full_dispatch_request
      gunicorn-web stdout |     rv = self.dispatch_request()
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1935, in dispatch_request
      gunicorn-web stdout |     return self.view_functions[rule.endpoint](**req.view_args)
      gunicorn-web stdout |   File "/quay-registry/endpoints/decorators.py", line 246, in wrapper
      gunicorn-web stdout |     return func(*args, **kwargs)
      gunicorn-web stdout |   File "/quay-registry/auth/decorators.py", line 65, in wrapper
      gunicorn-web stdout |     return func(*args, **kwargs)
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/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 73, in wrapper
      gunicorn-web stdout |     resp = func(*args, **kwargs)
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/site-packages/flask_restful/__init__.py", line 458, in wrapper
      gunicorn-web stdout |     resp = resource(*args, **kwargs)
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/site-packages/flask/views.py", line 89, in view
      gunicorn-web stdout |     return self.dispatch_request(*args, **kwargs)
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/site-packages/flask_restful/__init__.py", line 573, in dispatch_request
      gunicorn-web stdout |     resp = meth(*args, **kwargs)
      gunicorn-web stdout |   File "/quay-registry/endpoints/decorators.py", line 175, in wrapper
      gunicorn-web stdout |     return func(*args, **kwargs)
      gunicorn-web stdout |   File "/quay-registry/endpoints/decorators.py", line 154, in wrapper
      gunicorn-web stdout |     return func(*args, **kwargs)
      gunicorn-web stdout |   File "/quay-registry/endpoints/api/__init__.py", line 382, in wrapped
      gunicorn-web stdout |     return func(*args, **kwargs)
      gunicorn-web stdout |   File "/quay-registry/endpoints/api/__init__.py", line 228, in wrapper
      gunicorn-web stdout |     return func(self, *args, **kwargs)
      gunicorn-web stdout |   File "/quay-registry/endpoints/api/__init__.py", line 205, in wrapper
      gunicorn-web stdout |     (result, next_page_token) = func(self, *args, **kwargs)
      gunicorn-web stdout |   File "/quay-registry/endpoints/api/repository.py", line 251, in get
      gunicorn-web stdout |     return {"repositories": [repo.to_dict() for repo in repos]}, next_page_token
      gunicorn-web stdout |   File "/quay-registry/endpoints/api/repository.py", line 251, in <listcomp>
      gunicorn-web stdout |     return {"repositories": [repo.to_dict() for repo in repos]}, next_page_token
      gunicorn-web stdout |   File "/quay-registry/endpoints/api/repository_models_interface.py", line 61, in to_dict
      gunicorn-web stdout |     repo["quota_report"] = model.namespacequota.get_repo_quota_for_view(
      gunicorn-web stdout |   File "/quay-registry/data/model/namespacequota.py", line 320, in get_repo_quota_for_view
      gunicorn-web stdout |     repo_size = model.repository.get_repository_size_and_cache(repository_ref.id).get(
      gunicorn-web stdout |   File "/quay-registry/data/model/repository.py", line 697, in get_repository_size_and_cache
      gunicorn-web stdout |     force_cache_repo_size(repo_id)
      gunicorn-web stdout |   File "/quay-registry/data/model/repository.py", line 753, in force_cache_repo_size
      gunicorn-web stdout |     RepositorySize.create(repository_id=repo_id, size_bytes=size)
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/site-packages/peewee.py", line 6235, in create
      gunicorn-web stdout |     inst.save(force_insert=True)
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/site-packages/peewee.py", line 6433, in save
      gunicorn-web stdout |     pk = self.insert(**field_dict).execute()
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/site-packages/peewee.py", line 1845, in inner
      gunicorn-web stdout |     return method(self, database, *args, **kwargs)
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/site-packages/peewee.py", line 1916, in execute
      gunicorn-web stdout |     return self._execute(database)
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/site-packages/peewee.py", line 2665, in _execute
      gunicorn-web stdout |     return super(Insert, self)._execute(database)
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/site-packages/peewee.py", line 2398, in _execute
      gunicorn-web stdout |     cursor = self.execute_returning(database)
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/site-packages/peewee.py", line 2405, in execute_returning
      gunicorn-web stdout |     cursor = database.execute(self)
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/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 226, in execute_sql
      gunicorn-web stdout |     cursor = super(RetryOperationalError, self).execute_sql(sql, params, commit)
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/site-packages/peewee.py", line 3064, in execute_sql
      gunicorn-web stdout |     self.commit()
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/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 "/usr/local/lib/python3.8/site-packages/peewee.py", line 183, in reraise
      gunicorn-web stdout |     raise value.with_traceback(tb)
      gunicorn-web stdout |   File "/usr/local/lib/python3.8/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 "repositorysize_repository_id"
      gunicorn-web stdout | DETAIL:  Key (repository_id)=(1) already exists.
      gunicorn-web stdout | 2022-04-29 02:40:24,028 [227] [INFO] [gunicorn.access]  - - [29/Apr/2022:02:40:24 +0000] "GET /api/v1/repository?last_modified=true&namespace=qateam&popularity=true&public=false&quota=true&state=true HTTP/1.0" 500 0 "-" "-" 

              kwestpha@redhat.com Keith Westphal (Inactive)
              lzha1981 luffy zhang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: