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

Quay container crashes when no user exists in database

XMLWordPrintable

    • 0

      Quay container crashes at start-up due to not-null constraint violation. This occurs when the container attempts to log the creation of the service key. If this happens when no user exists in the database, the logging will fail and throw the following error:

      ```
      Traceback (most recent call last):
      File "./boot.py", line 136, in <module>
      main()
      File "./boot.py", line 128, in main
      setup_jwt_proxy()
      File "./boot.py", line 90, in setup_jwt_proxy
      app.config["INSTANCE_SERVICE_KEY_SERVICE"], get_audience(), expiration_date=expiration
      File "/quay-registry/util/generatepresharedkey.py", line 35, in generate_key
      logs_model.log_action("service_key_create", metadata=key_log_metadata)
      File "/quay-registry/data/logs_model/table_logs_model.py", line 236, in log_action
      timestamp=timestamp,
      File "/quay-registry/data/model/log.py", line 268, in log_action
      LogEntry3.create(**log_data)
      File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/peewee.py", line 6163, in create
      inst.save(force_insert=True)
      File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/peewee.py", line 6357, in save
      pk = self.insert(**field_dict).execute()
      File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/peewee.py", line 1812, in inner
      return method(self, database, *args, **kwargs)
      File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/peewee.py", line 1883, in execute
      return self._execute(database)
      File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/peewee.py", line 2623, in _execute
      return super(Insert, self)._execute(database)
      File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/peewee.py", line 2358, in _execute
      cursor = self.execute_returning(database)
      File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/peewee.py", line 2365, in execute_returning
      cursor = database.execute(self)
      File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/peewee.py", line 3018, in execute
      return self.execute_sql(sql, params, commit=commit)
      File "/quay-registry/data/database.py", line 213, in execute_sql
      cursor = super(RetryOperationalError, self).execute_sql(sql, params, commit)
      File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/peewee.py", line 3012, in execute_sql
      self.commit()
      File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/peewee.py", line 2783, in _exit_
      reraise(new_type, new_type(*exc_args), traceback)
      File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/peewee.py", line 3005, in execute_sql
      cursor.execute(sql, params or ())
      peewee.IntegrityError: null value in column "account_id" violates not-null constraint
      DETAIL: Failing row contains (1, 48, null, null, null, 2020-05-27 15:22:13.794873, null, {"preshared": true, "name": "http://quay:8081", "service": "quay...).
      ```

      To recreate:

      • Create fresh Redis and Postgresql containers with no users present
      • Bring up Quay container in registry mode

            jonathankingfc Jonathan King
            jonathankingfc Jonathan King
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: