{"record":{"id":"87e55eda59b7e9a2","repo":"alibaba/canal","slug":"failed-to-fetch-the-data-after-87e55e","errorCode":null,"errorMessage":"Failed to fetch the data after: {}","messagePattern":"Failed to fetch the data after: (.+?)","errorType":"exception","errorClass":"CanalClientException","httpStatus":null,"severity":"warning","filePath":"connector/rocketmq-connector/src/main/java/com/alibaba/otter/canal/connector/rocketmq/consumer/CanalRocketMQConsumer.java","lineNumber":197,"sourceCode":"        boolean isSuccess = batchMessage.isSuccess();\n        return isCompleted && isSuccess;\n    }\n\n    @Override\n    public List<CommonMessage> getMessage(Long timeout, TimeUnit unit) {\n        try {\n            if (this.lastGetBatchMessage != null) {\n                throw new CanalClientException(\"mq get/ack not support concurrent & async ack\");\n            }\n\n            ConsumerBatchMessage<CommonMessage> batchMessage = messageBlockingQueue.poll(timeout, unit);\n            if (batchMessage != null) {\n                this.lastGetBatchMessage = batchMessage;\n                return batchMessage.getData();\n            }\n        } catch (InterruptedException ex) {\n            logger.warn(\"Get message timeout\", ex);\n            throw new CanalClientException(\"Failed to fetch the data after: \" + timeout);\n        }\n        return null;\n    }\n\n    @Override\n    public void rollback() {\n        try {\n            if (this.lastGetBatchMessage != null) {\n                this.lastGetBatchMessage.fail();\n            }\n        } finally {\n            this.lastGetBatchMessage = null;\n        }\n    }\n\n    @Override\n    public void ack() {\n        try {","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/alibaba/canal/blob/87be50e87686a3e8af08c368d0e1ffd1f59eb04a/connector/rocketmq-connector/src/main/java/com/alibaba/otter/canal/connector/rocketmq/consumer/CanalRocketMQConsumer.java#L179-L215","documentation":"Thrown by CanalRocketMQConsumer.getMessage when messageBlockingQueue.poll(timeout, unit) is interrupted while waiting for a batch. This is a thread-interruption signal (usually shutdown), not a broker error or a true poll timeout — the connector reuses the 'Failed to fetch' wording but the cause is InterruptedException.","triggerScenarios":"poll(timeout, unit) at line 192 throws InterruptedException because Thread.interrupt() was invoked on the consuming thread — e.g. during executor shutdownNow() or application stop.","commonSituations":"Controlled shutdown interrupting the consumer thread; scheduler/executor shutdownNow; an explicit interrupt from upstream code. Benign during a clean stop.","solutions":["During shutdown, log and exit, restoring the interrupt flag.","If unexpected, locate and stop the source of Thread.interrupt() on the consumer thread.","Do not confuse this with a broker timeout — increasing poll timeout will not prevent an interrupt."],"exampleFix":"// before\n} catch (InterruptedException ex) {\n    logger.warn(\"Get message timeout\", ex);\n    throw new CanalClientException(\"Failed to fetch the data after: \" + timeout);\n}\n\n// after — accurate interruption handling\n} catch (InterruptedException ex) {\n    logger.warn(\"Get message interrupted\", ex);\n    Thread.currentThread().interrupt();\n    throw new CanalClientException(\"Get message interrupted after: \" + timeout);\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"} catch (InterruptedException ex) {\n    logger.warn(\"Get message interrupted\", ex);\n    Thread.currentThread().interrupt();\n    if (isShuttingDown()) return Collections.emptyList();\n    throw new CanalClientException(\"Get message interrupted after: \" + timeout);\n}","preventionTips":["Restore the interrupt flag after catching InterruptedException.","Treat shutdown-time interruption as expected.","This is interruption, not a broker timeout — do not lengthen the poll to 'fix' it."],"tags":["rocketmq","consumer","threading","canal-connector","interruption"],"backgroundTag":null,"analyzedSha":"87be50e87686a3e8af08c368d0e1ffd1f59eb04a","analyzedAt":"2026-08-14T04:30:11.918Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}