{"record":{"id":"9e7745746086a79d","repo":"apache/cassandra","slug":"stream-failed-nsession-peer-peer-failurereaso","errorCode":null,"errorMessage":"Stream failed: \\nSession peer <peer> <failureReason> (per failed session)","messagePattern":"Stream failed: \\\\nSession peer <peer> <failureReason> \\(per failed session\\)","errorType":"exception","errorClass":"StreamException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/streaming/StreamResultFuture.java","lineNumber":252,"sourceCode":"    }\n\n    private synchronized void maybeComplete()\n    {\n        if (finishedAllSessions())\n        {\n            StreamState finalState = getCurrentState();\n            if (finalState.hasFailedSession())\n            {\n                StringBuilder stringBuilder = new StringBuilder();\n                stringBuilder.append(\"Stream failed: \");\n                for (SessionInfo info : finalState.sessions())\n                {\n                    if (info.isFailed())\n                        stringBuilder.append(\"\\nSession peer \").append(info.peer).append(' ').append(info.failureReason);\n                }\n                String message = stringBuilder.toString();\n                logger.warn(\"[Stream #{}] {}\", planId, message);\n                tryFailure(new StreamException(finalState, message));\n            }\n            else if (finalState.hasAbortedSession())\n            {\n                logger.info(\"[Stream #{}] Stream aborted\", planId);\n                trySuccess(finalState);\n            }\n            else\n            {\n                logger.info(\"[Stream #{}] All sessions completed\", planId);\n                trySuccess(finalState);\n            }\n        }\n    }\n\n    public StreamSession getSession(InetAddressAndPort peer, int sessionIndex)\n    {\n        return coordinator.getSessionById(peer, sessionIndex);\n    }","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/streaming/StreamResultFuture.java#L234-L270","documentation":"StreamResultFuture.maybeComplete() finalizes a streaming plan. If any session failed (info.isFailed()), it builds a summary listing each failed peer and its failureReason, logs it as a warning ('[Stream #id] Stream failed: ...'), and tryFailure(new StreamException(finalState, message)). The overall stream future completes exceptionally with this StreamException.","triggerScenarios":"Any streaming session in the plan ends in FAILED state — e.g. peer node down mid-stream, network interruption, disk errors on receiver, or range movement during bootstrap/repair/decommission.","commonSituations":"Node restarts during bootstrap/repair; network partitions or timeouts between datacenters; misconfigured streaming_socket settings; disk full on the receiving node.","solutions":["Read the per-peer failureReason lines in the message/log to find the root cause (e.g. StreamException from the peer)","Verify connectivity between the nodes and re-run repair/bootstrap (nodetool repair, or retry the operation)","Check the receiving node's logs and disk space; fix any underlying I/O issue","Increase streaming timeouts/throughput settings if the failure was a slow-link timeout"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// before streaming, verify peers reachable\nfor (InetAddressAndPort peer : peers)\n    if (!isReachable(peer)) throw new IllegalStateException(\"Peer down, streaming would fail: \" + peer);","typeGuard":null,"tryCatchPattern":"try {\n    streamFuture.get();\n} catch (ExecutionException e) {\n    if (e.getCause() instanceof StreamException se) {\n        // message lists each failed peer + failureReason\n        se.getMessage().lines().filter(l -> l.contains(\"Session peer\"))\n          .forEach(l -> logger.error(\"Stream failure: {}\", l));\n        scheduleStreamRetry();\n    }\n}","preventionTips":["Check node/disk/network health before bootstrap/repair","Retry failed streams after transient network issues","Monitor streaming metrics and logs for repeated peer failures"],"tags":["streaming","network","repair","bootstrap"],"backgroundTag":"http-request-failed","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-15T13:17:12.816Z"}