{"record":{"id":"cf6a592cb412f209","repo":"apache/dolphinscheduler","slug":"zookeeper-registry-start-failed","errorCode":null,"errorMessage":"Zookeeper registry start failed","messagePattern":"Zookeeper registry start failed","errorType":"exception","errorClass":"RegistryException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java","lineNumber":116,"sourceCode":"    }\n\n    @Override\n    public void start() {\n        final StopWatch stopWatch = StopWatch.createStarted();\n        client.start();\n        try {\n            if (!client.blockUntilConnected(DurationUtils.toMillisInt(properties.getBlockUntilConnected()),\n                    MILLISECONDS)) {\n                client.close();\n                throw new RegistryException(\n                        \"zookeeper connect failed to: \" + properties.getConnectString() + \" in : \"\n                                + properties.getBlockUntilConnected().toMillis() + \"ms\");\n            }\n            stopWatch.stop();\n            log.info(\"ZookeeperRegistry started at: {}/ms\", stopWatch.getTime());\n        } catch (InterruptedException e) {\n            Thread.currentThread().interrupt();\n            throw new RegistryException(\"Zookeeper registry start failed\", e);\n        }\n    }\n\n    @Override\n    public void addConnectionStateListener(ConnectionListener listener) {\n        client.getConnectionStateListenable().addListener(new ZookeeperConnectionStateListener(listener));\n    }\n\n    @Override\n    public void connectUntilTimeout(@NonNull Duration timeout) throws RegistryException {\n        try {\n            if (!client.blockUntilConnected(DurationUtils.toMillisInt(timeout), MILLISECONDS)) {\n                throw new RegistryException(\n                        String.format(\"Cannot connect to registry in %s s\", timeout.getSeconds()));\n            }\n        } catch (RegistryException e) {\n            throw e;\n        } catch (InterruptedException e) {","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L98-L134","documentation":"Thrown by ZookeeperRegistry.start() when the thread waiting for the ZooKeeper connection is interrupted (InterruptedException). The interrupt flag is re-set before throwing. It means startup was aborted by an external interruption (e.g. shutdown) rather than a connection failure.","triggerScenarios":"Calling start() while the executing thread receives Thread.interrupt() — typically application shutdown, executor termination, or a caller cancelling startup.","commonSituations":"Service stopped mid-startup; JVM shutdown hooks; thread pools shutting down while registry init runs; timeouts in orchestrators that interrupt long-running init threads.","solutions":["Check whether the application was shutting down when start() ran; if so this is expected","Avoid running start() on threads that get interrupted by other components; start the registry before beginning shutdown","Ensure startup code preserves the interrupt status and exits cleanly instead of retrying","If interruption comes from a watchdog, increase its startup timeout"],"exampleFix":"// before\nregistry.start();\n// after\ntry {\n    registry.start();\n} catch (RegistryException e) {\n    if (Thread.currentThread().isInterrupted()) {\n        log.info(\"Registry startup interrupted, aborting\");\n        return;\n    }\n    throw e;\n}","handlingStrategy":"try-catch","validationCode":"if (Thread.currentThread().isInterrupted()) {\n    throw new IllegalStateException(\"Skipping registry start: thread already interrupted\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    registry.start();\n} catch (RegistryException e) {\n    if (Thread.currentThread().isInterrupted()) {\n        log.info(\"Registry start interrupted (likely shutdown); aborting\");\n        return;\n    }\n    throw e;\n}","preventionTips":["Start the registry before shutdown hooks can fire","Avoid initializing the registry on threads managed by pools that shut down early","Do not swallow InterruptedException in surrounding code; check isInterrupted","Give watchdogs/orchestrators a startup timeout longer than registry init"],"tags":["zookeeper","interrupt","startup","thread"],"backgroundTag":"request-timeout","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}