Uploaded image for project: 'Red Hat Developer Hub Bugs'
  1. Red Hat Developer Hub Bugs
  2. RHDHBUGS-2617

RHDH failed with 'replicas > 1' on very first start

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • None
    • 1.9.0
    • Database, Helm Chart, Operator
    • None
    • False
    • Hide

      None

      Show
      None
    • False
    • Text to be added
    • Known Issue

      Description of problem:

      Starting first time (when databases/tables are not created) with:

      • local (not external) PostgreSQL and
      • number of replicaas > 1

      RHDH failed with either:

      Table already exists error, like :

      2026-02-05T12:58:08.964Z backstage error Module rbac in Plugin 'permission' threw an error during startup, waiting for 5 other plugins to finish before shutting down the process. Module 'rbac' for plugin 'permission' startup failed; caused by QueryFailedError: relation "casbin_rule" already exists type="initialization" cause={"query":"CREATE TABLE \"casbin_rule\" (\"id\" SERIAL NOT NULL, \"ptype\" character varying, \"v0\" character varying, \"v1\" character varying, \"v2\" character varying, \"v3\" character varying, \"v4\" character varying, \"v5\" character varying, \"v6\" character varying, CONSTRAINT \"PK_e147354d31e2748a3a5da5e3060\" PRIMARY KEY (\"id\"))","driverError":{"length":105,"name":"error","severity":"ERROR","code":"42P07","file":"heap.c","line":"1149","routine":"heap_create_with_catalog"},"length":105,"severity":"ERROR","code":"42P07","file":"heap.c","line":"1149","routine":"heap_create_with_catalog"} name="QueryFailedError" stack="QueryFailedError: Module 'rbac' for plugin 'permission' startup failed; caused by QueryFailedError: relation \"casbin_rule\" already exists\n    at /opt/app-root/src/node_modules/@backstage/backend-app-api/dist/wiring/BackendInitializer.cjs.js:285:27\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async /opt/app-root/src/node_modules/@backstage/backend-app-api/dist/wiring/BackendInitializer.cjs.js:284:19\n    at async processNode (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/lib/DependencyGraph.cjs.js:181:22)\n    at async Promise.all (index 0)\n    at async processMoreNodes (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/lib/DependencyGraph.cjs.js:176:7)\n    at async processNode (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/lib/DependencyGraph.cjs.js:193:7)\n    at async Promise.all (index 0)\n    at async processMoreNodes (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/lib/DependencyGraph.cjs.js:176:7)\n    at async DependencyGraph.parallelTopologicalTraversal (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/lib/DependencyGraph.cjs.js:195:5)\n    at async /opt/app-root/src/node_modules/@backstage/backend-app-api/dist/wiring/BackendInitializer.cjs.js:271:13\n    at async Promise.allSettled (index 7)\n    at async #doStart (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/wiring/BackendInitializer.cjs.js:242:21)\n    at async BackendInitializer.start (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/wiring/BackendInitializer.cjs.js:160:5)\n    at async BackstageBackend.start (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/wiring/BackstageBackend.cjs.js:19:5)"
      2026-02-05T12:58:08.964Z backstage error Plugin 'permission' threw an error during startup, waiting for 4 other plugins to finish before shutting down the process. Module 'rbac' for plugin 'permission' startup failed; caused by QueryFailedError: relation "casbin_rule" already exists type="initialization" cause={"query":"CREATE TABLE \"casbin_rule\" (\"id\" SERIAL NOT NULL, \"ptype\" character varying, \"v0\" character varying, \"v1\" character varying, \"v2\" character varying, \"v3\" character varying, \"v4\" character varying, \"v5\" character varying, \"v6\" character varying, CONSTRAINT \"PK_e147354d31e2748a3a5da5e3060\" PRIMARY KEY (\"id\"))","driverError":{"length":105,"name":"error","severity":"ERROR","code":"42P07","file":"heap.c","line":"1149","routine":"heap_create_with_catalog"},"length":105,"severity":"ERROR","code":"42P07","file":"heap.c","line":"1149","routine":"heap_create_with_catalog"} name="QueryFailedError" stack="QueryFailedError: Module 'rbac' for plugin 'permission' startup failed; caused by QueryFailedError: relation \"casbin_rule\" already exists\n    at /opt/app-root/src/node_modules/@backstage/backend-app-api/dist/wiring/BackendInitializer.cjs.js:285:27\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async /opt/app-root/src/node_modules/@backstage/backend-app-api/dist/wiring/BackendInitializer.cjs.js:284:19\n    at async processNode (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/lib/DependencyGraph.cjs.js:181:22)\n    at async Promise.all (index 0)\n    at async processMoreNodes (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/lib/DependencyGraph.cjs.js:176:7)\n    at async processNode (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/lib/DependencyGraph.cjs.js:193:7)\n    at async Promise.all (index 0)\n    at async processMoreNodes (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/lib/DependencyGraph.cjs.js:176:7)\n    at async DependencyGraph.parallelTopologicalTraversal (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/lib/DependencyGraph.cjs.js:195:5)\n    at async /opt/app-root/src/node_modules/@backstage/backend-app-api/dist/wiring/BackendInitializer.cjs.js:271:13\n    at async Promise.allSettled (index 7)\n    at async #doStart (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/wiring/BackendInitializer.cjs.js:242:21)\n    at async BackendInitializer.start (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/wiring/BackendInitializer.cjs.js:160:5)\n    at async BackstageBackend.start (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/wiring/BackstageBackend.cjs.js:19:5)"
       

      (it can be for any and multiple plugins)
      Then readiness check failed and app is unreachabe

      OR
      "Migration table is already locked" error, like:

      Can't take lock to run migrations: Migration table is already locked
      If you are sure migrations are not running you can release the lock manually by running 'knex migrate:unlock'
      2025-11-20T12:11:44.692Z backstage error Plugin 'catalog' threw an error during startup, waiting for 12 other plugins to finish before shutting down the process. Failed to instantiate service 'core.httpRouter' for 'catalog' because the factory function threw an error, Error: Failed to instantiate service 'core.auth' for 'catalog' because the factory function threw an error, MigrationLocked: Migration table is already locked type="initialization" stack="Error: Failed to instantiate service 'core.httpRouter' for 'catalog' because the factory function threw an error, Error: Failed to instantiate service 'core.auth' for 'catalog' because the factory function threw an error, MigrationLocked: Migration table is already locked\n    at /opt/app-root/src/node_modules/@backstage/backend-app-api/dist/wiring/ServiceRegistry.cjs.js:232:21\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async Promise.all (index 0)\n    at async ServiceRegistry.initializeEagerServicesWithScope (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/wiring/ServiceRegistry.cjs.js:161:11)\n    at async /opt/app-root/src/node_modules/@backstage/backend-app-api/dist/wiring/BackendInitializer.cjs.js:240:11\n    at async Promise.allSettled (index 2)\n    at async #doStart (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/wiring/BackendInitializer.cjs.js:233:21)\n    at async BackendInitializer.start (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/wiring/BackendInitializer.cjs.js:163:5)\n    at async BackstageBackend.start (/opt/app-root/src/node_modules/@backstage/backend-app-api/dist/wiring/BackstageBackend.cjs.js:19:5)"
       

      and app crashed.

      NOTE: Starting with 1 replica and scaling up is working well.

      Prerequisites (if any, like setup, operators/versions):

      "Migration table is already locked" noticed in earlier version as well

      "Table already exists" noticed recently

      Steps to Reproduce

       

      Run RHDH with either Operator or Chart with configuration above

      Actual results:

      RHDH failed

      Expected results:

      RHDH run

      Reproducibility (Always/Intermittent/Only Once):

      "Table already exists" - often

      "Migration table is already locked" - sometimes

       

              gazarenk-1 Gennady Azarenkov
              gazarenk-1 Gennady Azarenkov
              RHDH Install
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: