{"record":{"id":"fdae936d030628af","repo":"apache/seatunnel","slug":"close-scanner-from-failed","errorCode":null,"errorMessage":"Close scanner from {} failed.","messagePattern":"Close scanner from (.+?) failed\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/backend/BackendClient.java","lineNumber":248,"sourceCode":"        for (int attempt = 0; attempt < retries; ++attempt) {\n            log.debug(\"Attempt {} to closeScanner {}.\", attempt, routing);\n            try {\n                TScanCloseResult result = client.closeScanner(closeParams);\n                if (result == null) {\n                    log.warn(\"CloseScanner result from {} is null.\", routing);\n                    continue;\n                }\n                if (!TStatusCode.OK.equals(result.getStatus().getStatusCode())) {\n                    log.warn(\n                            \"The status of get next result from {} is '{}', error message is: {}.\",\n                            routing,\n                            result.getStatus().getStatusCode(),\n                            result.getStatus().getErrorMsgs());\n                    continue;\n                }\n                break;\n            } catch (TException e) {\n                log.warn(\"Close scanner from {} failed.\", routing, e);\n            }\n        }\n        log.info(\"CloseScanner to Doris BE '{}' success.\", routing);\n        close();\n    }\n}\n","sourceCodeStart":230,"sourceCodeEnd":255,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/backend/BackendClient.java#L230-L255","documentation":"closeScanner catches TException from the close RPC, logging this warning per failed attempt, then unconditionally proceeds to close the client and logs success. Because close is best-effort, this does not fail the job, but the BE-side scan context may not be released, risking leaked contexts on the BE.","triggerScenarios":"client.closeScanner throws TException on any attempt — connection already broken (common after a read failure or job cancel), BE unreachable during teardown, or thrift protocol error.","commonSituations":"Teardown after a failed read where the transport is already dead; job cancellation; network loss at end of read; BE restart before cleanup.","solutions":["Safe to ignore in most cases: contexts expire on the BE after the timeout.","If scan contexts accumulate, clean them up on the BE or restart the BE.","Investigate the underlying read/network failure that broke the connection before close.","Keep connector/Doris versions aligned to avoid protocol exceptions during close."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// TException during closeScanner is swallowed (logged) and close proceeds — no caller catch needed.\n// Treat repeated occurrences as a symptom of earlier transport failures and fix the root cause.","preventionTips":["Fix the underlying read/network failure that breaks the connection before teardown.","Ignore single occurrences after job cancellation; they are expected.","Monitor BE scan-context counts if jobs fail often mid-read.","Ensure clean network teardown between SeaTunnel workers and BEs."],"tags":["thrift","doris","rpc","cleanup","suppressed-exception"],"backgroundTag":"broken-pipe","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}