{"record":{"id":"0c1104266b1151aa","repo":"apache/druid","slug":"can-t-start-0c1104","errorCode":null,"errorMessage":"can't start.","messagePattern":"can't start\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authentication/db/updater/CoordinatorBasicAuthenticatorMetadataStorageUpdater.java","lineNumber":113,"sourceCode":"                                  // set a dependency here\n  )\n  {\n    this.exec = Execs.scheduledSingleThreaded(\"CoordinatorBasicAuthenticatorMetadataStorageUpdater-Exec--%d\");\n    this.authenticatorMapper = authenticatorMapper;\n    this.connector = connector;\n    this.connectorConfig = connectorConfig;\n    this.commonCacheConfig = commonCacheConfig;\n    this.objectMapper = objectMapper;\n    this.cacheNotifier = cacheNotifier;\n    this.cachedUserMaps = new ConcurrentHashMap<>();\n    this.authenticatorPrefixes = new HashSet<>();\n  }\n\n  @LifecycleStart\n  public void start()\n  {\n    if (!lifecycleLock.canStart()) {\n      throw new ISE(\"can't start.\");\n    }\n\n    if (authenticatorMapper == null || authenticatorMapper.getAuthenticatorMap() == null) {\n      return;\n    }\n\n    try {\n      LOG.info(\"Starting CoordinatorBasicAuthenticatorMetadataStorageUpdater.\");\n      BasicAuthUtils.maybeInitialize(\n          () -> {\n            for (Map.Entry<String, Authenticator> entry : authenticatorMapper.getAuthenticatorMap().entrySet()) {\n              Authenticator authenticator = entry.getValue();\n              if (authenticator instanceof BasicHTTPAuthenticator) {\n                String authenticatorName = entry.getKey();\n                authenticatorPrefixes.add(authenticatorName);\n                BasicHTTPAuthenticator basicHTTPAuthenticator = (BasicHTTPAuthenticator) authenticator;\n                BasicAuthDBConfig dbConfig = basicHTTPAuthenticator.getDbConfig();\n                byte[] userMapBytes = getCurrentUserMapBytes(authenticatorName);","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authentication/db/updater/CoordinatorBasicAuthenticatorMetadataStorageUpdater.java#L95-L131","documentation":"Thrown by CoordinatorBasicAuthenticatorMetadataStorageUpdater.start when lifecycleLock.canStart() returns false. This updater writes authenticator user maps to metadata storage; it must transition once from idle to started. Double-start, start-after-stop, or concurrent start attempts are rejected here as illegal state transitions.","triggerScenarios":"Calling start() twice on the updater; start() after stop() (stopped=true already set); lifecycle races between leadership election callbacks; manually starting in tests after framework start.","commonSituations":"Misordered lifecycle handler registration; restarting the updater on coordinator leadership change without proper stop; test suites reusing a stopped instance.","solutions":["Create a fresh updater instance rather than restarting a stopped one","Confirm the updater's @LifecycleStart handler is registered once and invoked once","Serialize lifecycle transitions (single owner thread/leader invokes start/stop)","Check logs for a prior start/stop that already moved the lifecycle lock"],"exampleFix":"// before\nupdater.start();\n// after\nif (lifecycleLock.canStart()) { updater.start(); } // or recreate instance after stop","handlingStrategy":"type-guard","validationCode":"if (!updaterStarted.compareAndSet(false, true)) { return; } updater.start();","typeGuard":"boolean canStart(CoordinatorBasicAuthenticatorMetadataStorageUpdater u) { return u != null && !stoppedFlag.get(); }","tryCatchPattern":"try { updater.start(); } catch (ISE e) { LOG.warn(\"updater start rejected (already started/stopped)\"); }","preventionTips":["Let the Druid Lifecycle invoke @LifecycleStart handlers once","Recreate the updater after stop rather than calling start again","Guard leadership-transition restart logic to avoid double start","Serialize lifecycle transitions through a single owner"],"tags":["lifecycle","illegal-state","metadata-store"],"backgroundTag":"invalid-state-transition","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}