{"record":{"id":"be03b5337585297c","repo":"apache/cassandra","slug":"failed-to-connect-to-s-for-streaming-data","errorCode":null,"errorMessage":"failed to connect to %s for streaming data","messagePattern":"failed to connect to (.+?) for streaming data","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/streaming/async/NettyStreamingConnectionFactory.java","lineNumber":86,"sourceCode":"                {\n                    Channel channel = result.getNow().success().channel;\n                    NettyStreamingChannel streamingChannel = new NettyStreamingChannel(channel, kind);\n                    if (kind == StreamingChannel.Kind.CONTROL)\n                    {\n                        ChannelPipeline pipeline = channel.pipeline();\n                        pipeline.addLast(\"stream\", streamingChannel);\n                    }\n                    return streamingChannel;\n                }\n                cause = result.cause();\n            }\n            if (!isSSLError(cause))\n            {\n                // Fallback only when the error is SSL related, otherwise retries are exhausted, so fail\n                break;\n            }\n        }\n        throw new IOException(\"failed to connect to \" + template.to + \" for streaming data\", cause);\n    }\n\n    @Override\n    public StreamingChannel create(InetSocketAddress to, int messagingVersion, StreamingChannel.Kind kind) throws IOException\n    {\n        return connect(new OutboundConnectionSettings(getByAddress(to)), messagingVersion, kind);\n    }\n\n    @Override\n    public StreamingChannel create(InetSocketAddress to,\n                                   InetSocketAddress preferred,\n                                   int messagingVersion,\n                                   StreamingChannel.Kind kind) throws IOException\n    {\n        return connect(new OutboundConnectionSettings(getByAddress(to), getByAddress(preferred)), messagingVersion, kind);\n    }\n}\n","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/streaming/async/NettyStreamingConnectionFactory.java#L68-L104","documentation":"NettyStreamingConnectionFactory.connect() establishes the outbound streaming data connection, retrying only when the failure is SSL-related. When retries are exhausted (or the failure is not SSL-related), it wraps the last cause in an IOException: 'failed to connect to <peer> for streaming data'.","triggerScenarios":"connect(OutboundConnectionSettings, messagingVersion, kind) invoked via create() when the TCP connection to the peer's streaming port fails — peer down, wrong IP, firewall blocking the streaming port (7000 family / ssl storage port), TLS handshake failure after exhausting SSL fallback retries.","commonSituations":"Target node down or decommissioned during repair/rebuild; firewalled streaming port between datacenters; incorrect broadcast/Preferred IP configuration; missing or mismatched SSL keystore/truststore for encrypted streaming.","solutions":["Verify the target node is up and the streaming port is reachable: nodetool status, then nc/telnet to peer host and streaming port from the source node.","Check firewall/SecurityGroup rules for the storage/streaming port (7000 or ssl_storage_port 7001) between the nodes.","Review address configuration (broadcast_address, broadcast_rpc_address, prefer_local, endpoint snitch) so the resolved peer address is correct.","If TLS is enabled, validate keystore/truststore paths and passwords in cassandra.yaml on both ends.","Retry once the peer recovers; streaming sessions will fail and the operation (repair/rebuild) must be rerun."],"exampleFix":"// before\n// connect() fails: peer unreachable on streaming port\n// after\n// verify reachability before starting the stream\nif (!reachable(peer, streamingPort, 5000)) {\n    throw new IOException(\"Peer \" + peer + \" not reachable on streaming port \" + streamingPort);\n}","handlingStrategy":"retry","validationCode":"try (Socket s = new Socket()) { s.connect(new InetSocketAddress(peer, streamingPort), 5000); } catch (IOException e) { /* abort before streaming */ }","typeGuard":null,"tryCatchPattern":"try { channel = factory.create(peerAddr, version, Kind.DATA); } catch (IOException e) { logger.error(\"Streaming connect to {} failed: {}\", peerAddr, e.getCause()); throw e; } // inspect e.getCause() for ConnectException vs SSLException","preventionTips":["Pre-check node liveness and streaming port reachability before repairs.","Keep firewalls/security groups open for streaming ports across DCs.","Validate SSL keystores/truststores on both ends of encrypted streaming.","Fix broadcast/preferred-IP settings so peer addresses resolve correctly."],"tags":["streaming","network","connection","tls"],"backgroundTag":"connection-refused","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}