{"record":{"id":"a17df52a609a662e","repo":"apache/rocketmq","slug":"senddefaultimpl-call-timeout","errorCode":null,"errorMessage":"sendDefaultImpl call timeout","messagePattern":"sendDefaultImpl call timeout","errorType":"exception","errorClass":"RemotingTooMuchRequestException","httpStatus":null,"severity":"error","filePath":"client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java","lineNumber":872,"sourceCode":"                } else {\n                    break;\n                }\n            }\n\n            if (sendResult != null) {\n                return sendResult;\n            }\n            String info = String.format(\"Send [%d] times, still failed, cost [%d]ms, Topic: %s, BrokersSent: %s\",\n                times,\n                System.currentTimeMillis() - beginTimestampFirst,\n                msg.getTopic(),\n                Arrays.toString(brokersSent));\n\n            info += FAQUrl.suggestTodo(FAQUrl.SEND_MSG_FAILED);\n\n            MQClientException mqClientException = new MQClientException(info, exception);\n            if (callTimeout) {\n                throw new RemotingTooMuchRequestException(\"sendDefaultImpl call timeout\");\n            }\n\n            if (exception instanceof MQBrokerException) {\n                mqClientException.setResponseCode(((MQBrokerException) exception).getResponseCode());\n            } else if (exception instanceof RemotingConnectException) {\n                mqClientException.setResponseCode(ClientErrorCode.CONNECT_BROKER_EXCEPTION);\n            } else if (exception instanceof RemotingTimeoutException) {\n                mqClientException.setResponseCode(ClientErrorCode.ACCESS_BROKER_TIMEOUT);\n            } else if (exception instanceof MQClientException) {\n                mqClientException.setResponseCode(ClientErrorCode.BROKER_NOT_EXIST_EXCEPTION);\n            }\n\n            throw mqClientException;\n        }\n\n        validateNameServerSetting();\n\n        throw new MQClientException(\"No route info of this topic: \" + msg.getTopic() + FAQUrl.suggestTodo(FAQUrl.NO_TOPIC_ROUTE_INFO),","sourceCodeStart":854,"sourceCodeEnd":890,"githubUrl":"https://github.com/apache/rocketmq/blob/293f5885719fc4aa3619446a1900f58ccfcfdd29/client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java#L854-L890","documentation":"RemotingTooMuchRequestException thrown at the end of sendDefaultImpl when the total elapsed time since the call began already exceeds the send timeout (callTimeout flag set from a timeout-class failure) - i.e. all retry times plus broker communication consumed the budget, and the loop aborts rather than issuing another attempt whose remaining timeout would be negative. This is client-side deadline enforcement after at least one timeout-flavored failure, not a broker rejection.","triggerScenarios":"triggerScenarios","commonSituations":"commonSituations","solutions":["Raise the budget: producer.setSendMsgTimeout(3000+) or pass a larger timeout to send(msg, timeout), and keep it >= (retries+1) * expected-RTT","Reduce attempts: producer.setRetryTimesWhenSendFailed(0/1) for fast-fail paths, or setRetryAnotherBrokerWhenNotStoreOK(false) to avoid extra hops","Investigate broker latency (broker flush disk type SYNC_FLUSH vs ASYNC_FLUSH, disk utilization, page cache) - if each attempt times out, timeouts only mask it","For latency-critical traffic, send with explicit timeout per call and implement app-level fallback (queue locally / circuit break) instead of relying on long client retries"],"exampleFix":"// before\nproducer.setSendMsgTimeout(500); // < RTT of cross-region link\nproducer.send(msg);\n// after\nproducer.setSendMsgTimeout(3_000);\nproducer.setRetryTimesWhenSendFailed(1);\nproducer.send(msg, 3_000);","handlingStrategy":"retry","validationCode":" // budget check before send: timeout must exceed (retries+1) * expected RTT\nint retries = producer.getRetryTimesWhenSendFailed();\nif (timeoutMs < (retries + 1) * expectedRttMs) {\n    timeoutMs = (retries + 1) * expectedRttMs * 2;\n}","typeGuard":null,"tryCatchPattern":"RetrySchemas.exponential(3, Duration.ofMillis(500)).retryOn(\n    RemotingTooMuchRequestException.class).execute(ctx -> producer.send(msg));\n// only if the operation is idempotent or message has unique key for dedup","preventionTips":["Size sendMsgTimeout as (retries+1) * worst-case RTT + margin","Lower retryTimesWhenSendFailed for fast-fail services instead of shrinking the timeout","Monitor broker latency; a persistent call timeout means a broker/network problem, not a config tweak","Make sends idempotent (message keys / dedup on consumer) so client retries are safe"],"tags":["rocketmq","producer","timeout","send","retries"],"backgroundTag":null,"analyzedSha":"293f5885719fc4aa3619446a1900f58ccfcfdd29","analyzedAt":"2026-08-14T11:50:13.822Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}