{"record":{"id":"0f7f82b2221f10b2","repo":"apache/rocketmq","slug":"call-timeout","errorCode":null,"errorMessage":"call timeout","messagePattern":"call timeout","errorType":"exception","errorClass":"RemotingTooMuchRequestException","httpStatus":null,"severity":"error","filePath":"client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java","lineNumber":1240,"sourceCode":"     */\n    public SendResult send(Message msg, MessageQueue mq)\n        throws MQClientException, RemotingException, MQBrokerException, InterruptedException {\n        return send(msg, mq, this.defaultMQProducer.getSendMsgTimeout());\n    }\n\n    public SendResult send(Message msg, MessageQueue mq, long timeout)\n        throws MQClientException, RemotingException, MQBrokerException, InterruptedException {\n        long beginStartTime = System.currentTimeMillis();\n        this.makeSureStateOK();\n        Validators.checkMessage(msg, this.defaultMQProducer);\n\n        if (!msg.getTopic().equals(mq.getTopic())) {\n            throw new MQClientException(\"message's topic not equal mq's topic\", null);\n        }\n\n        long costTime = System.currentTimeMillis() - beginStartTime;\n        if (timeout < costTime) {\n            throw new RemotingTooMuchRequestException(\"call timeout\");\n        }\n\n        return this.sendKernelImpl(msg, mq, CommunicationMode.SYNC, null, null, timeout);\n    }\n\n    /**\n     * KERNEL ASYNC -------------------------------------------------------\n     */\n    public void send(Message msg, MessageQueue mq, SendCallback sendCallback)\n        throws MQClientException, RemotingException, InterruptedException {\n        send(msg, mq, sendCallback, this.defaultMQProducer.getSendMsgTimeout());\n    }\n\n    /**\n     * @param msg\n     * @param mq\n     * @param sendCallback\n     * @param timeout      the <code>sendCallback</code> will be invoked at most time","sourceCodeStart":1222,"sourceCodeEnd":1258,"githubUrl":"https://github.com/apache/rocketmq/blob/293f5885719fc4aa3619446a1900f58ccfcfdd29/client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java#L1222-L1258","documentation":"RemotingTooMuchRequestException thrown by send(Message, MessageQueue, long timeout) when the local pre-send work (makeSureStateOK + Validators.checkMessage + the topic==mq equality check) alone consumed the whole timeout (costTime = now - beginStartTime >= timeout). Same deadline discipline as errors 274/275 but measured before sendKernelImpl is even entered - it almost always means the timeout argument is pathologically small, or validation is slow on huge message bodies (size checks over big arrays) under CPU pressure.","triggerScenarios":"triggerScenarios","commonSituations":"commonSituations","solutions":["Pass a realistic timeout (>= 1-3 seconds typical) and fix unit confusion at the call site (verify ms vs s)","Check the incoming deadline before calling send: if remaining budget < minimum (e.g. 100ms), fail fast or refresh the deadline instead of letting the client throw","If validation itself is slow (very large bodies), reduce message size / pre-validate at construction so the timed section stays cheap","Pin/monitor clock sync on hosts - NTP steps can fabricate timeouts (prefer chrony slew mode)"],"exampleFix":"// before\nlong deadlineNanos = ...;\nproducer.send(msg, mq, 50); // 50ms budget, validation alone exceeds it\n// after\nlong budget = Math.max(1_000, remainingDeadlineMs());\nproducer.send(msg, mq, budget);","handlingStrategy":"validation","validationCode":" long budget = Math.max(1_000, remainingDeadlineMs()); // never send with a starved budget\nif (budget < 1_000) budget = 1_000; // floor the timeout at 1s\nproducer.send(msg, mq, budget);","typeGuard":null,"tryCatchPattern":"try {\n    return producer.send(msg, mq, timeout);\n} catch (RemotingTooMuchRequestException e) {\n    if (\"call timeout\".equals(e.getMessage())) {\n        return producer.send(msg, mq, timeout * 4); // budget starved locally - retry larger\n    }\n    throw e;\n}","preventionTips":["Never pass timeout <= 0 or sub-100ms values to send(msg, mq, timeout)","Verify timeout units at call sites (milliseconds) - unit confusion is the top cause","Floor propagated deadlines before they reach the client","Keep message bodies within limits so Validators.checkMessage stays cheap"],"tags":["rocketmq","producer","timeout","validation","send"],"backgroundTag":null,"analyzedSha":"293f5885719fc4aa3619446a1900f58ccfcfdd29","analyzedAt":"2026-08-14T11:50:13.822Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}