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

Updating quota should not happen when Quay is in read only mode

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Critical
    • quay-v3.8.10
    • quay-v3.7.11, quay-v3.8.0
    • quay
    • 0

    Description

      When Quay's read only mode is turned on, the UI crashes with the following error:

      gunicorn-web stdout | 2022-12-23 11:30:30,891 [178] [ERROR] [endpoints.decorated]
      gunicorn-web stdout | Traceback (most recent call last):
      gunicorn-web stdout |   File "/usr/local/lib/python3.9/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.9/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 256, 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 "/quay-registry/util/request.py", line 50, in wrapper
      gunicorn-web stdout |     return decorator(func)(*args, **kwargs)
      gunicorn-web stdout |   File "/usr/local/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 73, in wrapper
      gunicorn-web stdout |     resp = func(*args, **kwargs)
      gunicorn-web stdout |   File "/usr/local/lib/python3.9/site-packages/flask_restful/__init__.py", line 467, in wrapper
      gunicorn-web stdout |     resp = resource(*args, **kwargs)
      gunicorn-web stdout |   File "/usr/local/lib/python3.9/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.9/site-packages/flask_restful/__init__.py", line 582, in dispatch_request
      gunicorn-web stdout |     resp = meth(*args, **kwargs)
      gunicorn-web stdout |   File "/quay-registry/endpoints/decorators.py", line 185, in wrapper
      gunicorn-web stdout |     return func(*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 460, in wrapped
      gunicorn-web stdout |     return func(*args, **kwargs)
      gunicorn-web stdout |   File "/quay-registry/endpoints/api/__init__.py", line 234, in wrapper
      gunicorn-web stdout |     return func(self, *args, **kwargs)
      gunicorn-web stdout |   File "/quay-registry/endpoints/api/__init__.py", line 211, in wrapper
      gunicorn-web stdout |     (result, next_page_token) = func(self, *args, **kwargs)
      gunicorn-web stdout |   File "/quay-registry/endpoints/api/repository.py", line 255, 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 255, 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 317, 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 711, 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 773, in force_cache_repo_size
      gunicorn-web stdout |     update = RepositorySize.update(size_bytes=size).where(
      gunicorn-web stdout |   File "/quay-registry/data/readreplica.py", line 157, in update
      gunicorn-web stdout |     raise ReadOnlyModeException()
      gunicorn-web stdout | data.readreplica.ReadOnlyModeException
      gunicorn-web stdout | 2022-12-23 11:30:30,898 [178] [DEBUG] [app] Ending request: urn:request:0859e195-3bfe-43e9-a1c9-a5756bf8a72d (/api/v1/repository) {'endpoint': 'api.repositorylist', 'request_id': 'urn:request:0859e195-3bfe-43e9-a1c9-a5756bf8a72d', 'remote_addr': '10.130.14.14', 'http_method': 'GET', 'original_url': 'QUAY_URL', 'path': '/api/v1/repository', 'parameters': {'last_modified': 'true', 'namespace': 'NAMESPACE', 'popularity': 'true', 'public': 'true', 'quota': 'true'}, 'json_body': None, 'confsha': 'd485beae', 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36'}
      

      Since the database is in read only mode, updates to it are not allowed. Exception is due to the following method:

      https://github.com/quay/quay/blob/6c45444496c104fa29165934ce8aac43840acfb3/data/model/repository.py#L744

      Please check! Thanks!

      Attachments

        Activity

          People

            Unassigned Unassigned
            rhn-support-ibazulic Ivan Bazulic
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: