{"record":{"id":"6c583a860addbda8","repo":"apache/dolphinscheduler","slug":"connect-to-host-host-failed-6c583a","errorCode":null,"errorMessage":"Connect to host: \" + host + \" failed","messagePattern":"Connect to host: \" \\+ host \\+ \" failed","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"dolphinscheduler-extract/dolphinscheduler-extract-base/src/main/java/org/apache/dolphinscheduler/extract/base/client/NettyRemotingClient.java","lineNumber":227,"sourceCode":"\n    /**\n     * create channel\n     *\n     * @param host host\n     * @return channel\n     */\n    Channel createChannel(Host host) {\n        try {\n            ChannelFuture future = bootstrap.connect(new InetSocketAddress(host.getIp(), host.getPort()));\n            future = future.sync();\n            if (future.isSuccess()) {\n                return future.channel();\n            } else {\n                throw new IllegalArgumentException(\"connect to host: \" + host + \" failed\", future.cause());\n            }\n        } catch (InterruptedException e) {\n            Thread.currentThread().interrupt();\n            throw new RuntimeException(\"Connect to host: \" + host + \" failed\", e);\n        }\n    }\n\n    @Override\n    public void close() {\n        if (isStarted.compareAndSet(true, false)) {\n            try {\n                closeChannels();\n                if (workerGroup != null) {\n                    this.workerGroup.shutdownGracefully();\n                }\n                log.info(\"netty client closed\");\n            } catch (Exception ex) {\n                log.error(\"netty client close exception\", ex);\n            }\n        }\n    }\n","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-extract/dolphinscheduler-extract-base/src/main/java/org/apache/dolphinscheduler/extract/base/client/NettyRemotingClient.java#L209-L245","documentation":"NettyRemotingClient.createChannel fails to establish a Netty channel to the remote host and wraps the underlying connect failure (future.cause()) in an IllegalArgumentException, or wraps an InterruptedException in a RuntimeException with the same message. It signals that the DolphinScheduler RPC client could not open a TCP connection to the target worker/api server address.","triggerScenarios":"Calling getOrCreateChannel -> createChannel for a host:port where the connect future completes unsuccessfully (connection refused, DNS failure, timeout) or the thread waiting on the connect future is interrupted.","commonSituations":"Target worker is down or not listening on the configured port; wrong host/port in server configuration; firewall or network partition blocking the port; DNS misconfiguration; the connecting thread is interrupted during shutdown.","solutions":["Verify the target host is reachable and the DolphinScheduler server is running on the configured port (telnet/nc host port)","Check the wrapped future.cause() in the stack trace — connection refused vs unknown host tells you which fix applies","Correct the host/port in the DolphinScheduler server/worker configuration","Check firewall/security-group rules and DNS resolution for the host","If caused by interruption, find and fix the code shutting down or interrupting the RPC client thread"],"exampleFix":"// before\nNettyRemotingClient client = NettyRemotingClient.getInstance();\nChannel channel = client.getChannel(\"192.168.1.50:1234\");\n// after\n// ensure the worker is up and the address is correct first\nNettyRemotingClient client = NettyRemotingClient.getInstance();\ntry (Channel channel = client.getChannel(\"192.168.1.50:1234\")) {\n    // use channel\n}","handlingStrategy":"retry","validationCode":"// pre-check reachability before RPC\ntry (Socket s = new Socket()) {\n    s.connect(new InetSocketAddress(host, port), 3000);\n} catch (IOException e) {\n    throw new IllegalStateException(\"Server \" + host + \":\" + port + \" unreachable: \" + e.getMessage());\n}","typeGuard":null,"tryCatchPattern":"try {\n    Channel ch = client.getChannel(host + \":\" + port);\n} catch (RuntimeException e) {\n    if (e.getCause() instanceof ConnectException) {\n        // retry with backoff / alert server is down\n    }\n    throw e;\n}","preventionTips":["Health-check target hosts before dispatching tasks","Keep server/worker addresses in configuration validated at startup","Set sane connect timeouts and alert on repeated connect failures","Ensure cluster nodes are up before rolling scheduling"],"tags":["netty","rpc","network","connection"],"backgroundTag":"connection-refused","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"}