{"record":{"id":"bce9c39fcd59a7b6","repo":"apache/incubator-seata","slug":"timeout-should-more-than-0ms","errorCode":null,"errorMessage":"timeout should more than 0ms","messagePattern":"timeout should more than 0ms","errorType":"exception","errorClass":"FrameworkException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/seata/core/rpc/netty/AbstractNettyRemoting.java","lineNumber":187,"sourceCode":"    @Override\n    public void destroy() {\n        timerExecutor.shutdown();\n        messageExecutor.shutdown();\n    }\n\n    /**\n     * rpc sync request\n     * Obtain the return result through MessageFuture blocking.\n     *\n     * @param channel       netty channel\n     * @param rpcMessage    rpc message\n     * @param timeoutMillis rpc communication timeout\n     * @return response message\n     * @throws TimeoutException\n     */\n    protected Object sendSync(Channel channel, RpcMessage rpcMessage, long timeoutMillis) throws TimeoutException {\n        if (timeoutMillis <= 0) {\n            throw new FrameworkException(\"timeout should more than 0ms\");\n        }\n        if (channel == null) {\n            LOGGER.warn(\"sendSync nothing, caused by null channel.\");\n            return null;\n        }\n        if (MsgVersionHelper.versionNotSupport(channel, rpcMessage)) {\n            if (LOGGER.isDebugEnabled()) {\n                LOGGER.debug(\n                        \"Message sending will be skipped as the client version does not support it,{}\", rpcMessage);\n            }\n            return new VersionNotSupportMessage();\n        }\n\n        MessageFuture messageFuture = new MessageFuture();\n        messageFuture.setRequestMessage(rpcMessage);\n        messageFuture.setTimeout(timeoutMillis);\n        futures.put(rpcMessage.getId(), messageFuture);\n","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/apache/incubator-seata/blob/e01f97c6db397165050caa6764020410c2c8199a/core/src/main/java/org/apache/seata/core/rpc/netty/AbstractNettyRemoting.java#L169-L205","documentation":"AbstractNettyRemoting.sendSync guards the RPC timeout up front: a timeoutMillis of 0 or less cannot block meaningfully on the MessageFuture, so it fails fast with FrameworkException instead of hanging or busy-waiting. The value typically originates from RPC timeout config (tm/rm rpc timeout, or per-request timeouts derived from config).","triggerScenarios":"Invoking a sync request with a computed timeout that is <=0 — config set to 0, a unit-conversion bug (seconds vs ms), or code computing timeout = deadline - now after the deadline already passed.","commonSituations":"seata client rpc timeout configured as 0 (misread as 'infinite'), custom DeadlineRunner code subtracting elapsed time and passing a negative remainder, or copying timeouts from another system expressed in seconds into a millisecond API.","solutions":["Set a positive timeout in milliseconds (e.g. 30000) in the client tm/rm RPC timeout configuration.","Fix unit math at call sites: ensure milliseconds are passed, and clamp computed timeouts to a minimum of 1.","If you intended 'no timeout', use async send instead of sendSync — there is no infinite sync wait."],"exampleFix":"# before\nseata.client.tm.rpc-timeout=0\n# after\nseata.client.tm.rpc-timeout=30000","handlingStrategy":"validation","validationCode":"long safeTimeout(long ms) { return Math.max(ms, 1_000); }\nlong t = safeTimeout(configuredTimeout); // reject 0/negative before sendSync","typeGuard":"boolean usableTimeout(long ms) { return ms > 0; }","tryCatchPattern":"catch (FrameworkException e) {\n    if (e.getMessage().contains(\"timeout should more than 0ms\")) { fixConfigThenRetry(defaultTimeout); }\n    else throw e;\n}","preventionTips":["Always express rpc timeouts in milliseconds explicitly","Clamp computed (deadline - now) timeouts to a positive floor","Treat 0-timeout config as invalid at load time"],"tags":["config","timeout","validation","rpc"],"backgroundTag":null,"analyzedSha":"e01f97c6db397165050caa6764020410c2c8199a","analyzedAt":"2026-08-14T10:23:53.097Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}