{"record":{"id":"ca09ab0630ba2c01","repo":"apache/incubator-seata","slug":"connect-cancelled-can-not-connect-to-services-ser","errorCode":null,"errorMessage":"connect cancelled, can not connect to services-server.","messagePattern":"connect cancelled, can not connect to services-server\\.","errorType":"exception","errorClass":"FrameworkException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/seata/core/rpc/netty/NettyClientBootstrap.java","lineNumber":183,"sourceCode":"            eventLoopGroupWorker.shutdownGracefully();\n        } catch (Exception exx) {\n            LOGGER.error(\"Failed to shutdown: {}\", exx.getMessage());\n        }\n    }\n\n    /**\n     * Gets new channel.\n     *\n     * @param address the address\n     * @return the new channel\n     */\n    public Channel getNewChannel(InetSocketAddress address) {\n        Channel channel;\n        ChannelFuture f = this.bootstrap.connect(address);\n        try {\n            f.await(this.nettyClientConfig.getConnectTimeoutMillis(), TimeUnit.MILLISECONDS);\n            if (f.isCancelled()) {\n                throw new FrameworkException(f.cause(), \"connect cancelled, can not connect to services-server.\");\n            } else if (!f.isSuccess()) {\n                throw new FrameworkException(f.cause(), \"connect failed, can not connect to services-server.\");\n            } else {\n                channel = f.channel();\n            }\n\n            if (nettyClientConfig.getProtocol().equals(Protocol.GRPC.value)) {\n                Http2StreamChannelBootstrap bootstrap = new Http2StreamChannelBootstrap(channel);\n                bootstrap.handler(new ChannelInboundHandlerAdapter() {\n                    @Override\n                    public void handlerAdded(ChannelHandlerContext ctx) {\n                        Channel channel = ctx.channel();\n                        channel.pipeline()\n                                .addLast(new IdleStateHandler(\n                                        nettyClientConfig.getChannelMaxReadIdleSeconds(),\n                                        nettyClientConfig.getChannelMaxWriteIdleSeconds(),\n                                        nettyClientConfig.getChannelMaxAllIdleSeconds()));\n                        channel.pipeline().addLast(new GrpcDecoder());","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/apache/incubator-seata/blob/e01f97c6db397165050caa6764020410c2c8199a/core/src/main/java/org/apache/seata/core/rpc/netty/NettyClientBootstrap.java#L165-L201","documentation":"FrameworkException from NettyClientBootstrap.getNewChannel when the Netty connect future reports isCancelled() after awaiting the connect timeout. A cancelled connect future is rare — it usually indicates the future was cancelled externally or the channel setup aborted — and is reported with cause f.cause() if present.","triggerScenarios":"bootstrap.connect(address).await(connectTimeoutMillis) completing in a cancelled state: the connect attempt was cancelled before it succeeded or failed, e.g. by shutdown of the client event loop or an internal cancellation during channel creation.","commonSituations":"Client shutting down concurrently with a reconnect attempt; event loop group closed while a pooled channel was being created; very low connect timeouts causing the operation to be abandoned.","solutions":["Ensure the client is not being shut down while reconnection is in progress (stop transactions before closing the seata client)","Increase transport.connect-timeout-millis so connects are not abandoned prematurely","Verify event loop threads are healthy (no ThreadDeath/OOM in logs around the same time)","Retry the operation: cancelled connects are transient by nature — the next reconnect cycle typically succeeds"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (FrameworkException e) {\n    if (e.getMessage().contains(\"connect cancelled\")) {\n        // transient: retry once after a short delay; if persistent, check shutdown state\n    }\n}","preventionTips":["Do not shut down the seata client while reconnects are in flight","Set connect timeouts comfortably above network RTT","Retry cancelled connects once before escalating"],"tags":["network","connect","client","netty"],"backgroundTag":null,"analyzedSha":"e01f97c6db397165050caa6764020410c2c8199a","analyzedAt":"2026-08-14T10:23:53.097Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}