{"record":{"id":"dd780859c48a6dc0","repo":"apache/seatunnel","slug":"closescanner-result-from-is-null","errorCode":null,"errorMessage":"CloseScanner result from {} is null.","messagePattern":"CloseScanner result from (.+?) is null\\.","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":235,"sourceCode":"        log.error(ErrorMessages.CONNECT_FAILED_MESSAGE, routing);\n        //        throw new ConnectedFailedException(routing.toString(), ex);\n        throw new DorisConnectorException(\n                DorisConnectorErrorCode.SCAN_BATCH_FAILED, routing.toString(), ex);\n    }\n\n    /**\n     * close a scanner.\n     *\n     * @param closeParams thrift struct to required by request\n     */\n    public void closeScanner(TScanCloseParams closeParams) {\n        log.debug(\"CloseScanner to '{}', parameter is '{}'.\", routing, closeParams);\n        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    }","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/backend/BackendClient.java#L217-L253","documentation":"closeScanner sends TScanCloseParams to release the BE scan context. If the RPC returns null it logs this warning and retries; after retries the method proceeds to close the client regardless. Because scanner close is best-effort cleanup, a null response usually just means the scan context release could not be confirmed — leaked scan contexts on the BE are the practical consequence.","triggerScenarios":"client.closeScanner(closeParams) returns null on all retry attempts — typically because the scan context was already terminated (BE restart, expired context, prior getNext failure) or the BE returned an unexpected empty response.","commonSituations":"Cleanup after an earlier read failure or job cancellation; BE restarting during teardown; version/protocol mismatch.","solutions":["Usually safe to ignore if the read already completed; the context will expire on the BE.","If contexts leak, check/expire them on the BE (ADMIN CLEAN; monitor scan contexts) or restart the BE.","Verify BE logs for prior cancellation of the context.","Ensure connector and Doris versions match to avoid protocol-level null responses."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// closeScanner is best-effort; no exception escapes, so no catch is needed.\n// After the read completes, optionally verify the BE did not leak scan contexts.","preventionTips":["Let contexts expire on the BE rather than alerting on this warning.","Clean up leaked scan contexts if jobs are frequently cancelled.","Ensure orderly close after successful reads (client.closeScanner is called internally).","Keep versions aligned so close responses are well-formed."],"tags":["thrift","doris","rpc","cleanup","null-response"],"backgroundTag":"unexpected-api-response-shape","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"}