{"record":{"id":"589a24fec274f263","repo":"apache/incubator-seata","slug":"s-cost-d-ms","errorCode":null,"errorMessage":"%s ,cost: %d ms","messagePattern":"(.+?) ,cost: (.+?) ms","errorType":"exception","errorClass":"TimeoutException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/seata/core/protocol/MessageFuture.java","lineNumber":64,"sourceCode":"     * Get object.\n     *\n     * @param timeout the timeout\n     * @param unit    the unit\n     * @return the object\n     * @throws TimeoutException the timeout exception\n     * @throws InterruptedException the interrupted exception\n     */\n    public Object get(long timeout, TimeUnit unit) throws TimeoutException, InterruptedException {\n        Object result = null;\n        try {\n            result = origin.get(timeout, unit);\n            if (result instanceof TimeoutException) {\n                throw (TimeoutException) result;\n            }\n        } catch (ExecutionException e) {\n            throw new ShouldNeverHappenException(\"Should not get results in a multi-threaded environment\", e);\n        } catch (TimeoutException e) {\n            throw new TimeoutException(\n                    String.format(\"%s ,cost: %d ms\", e.getMessage(), System.currentTimeMillis() - start));\n        }\n\n        if (result instanceof RuntimeException) {\n            throw (RuntimeException) result;\n        } else if (result instanceof Throwable) {\n            throw new RuntimeException((Throwable) result);\n        }\n\n        return result;\n    }\n\n    /**\n     * Sets result message.\n     *\n     * @param obj the obj\n     */\n    public void setResultMessage(Object obj) {","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/apache/incubator-seata/blob/e01f97c6db397165050caa6764020410c2c8199a/core/src/main/java/org/apache/seata/core/protocol/MessageFuture.java#L46-L82","documentation":"MessageFuture.get(timeout, unit) is the sync-RPC primitive in Seata remoting: the caller blocks until the response (or an exception placeholder) completes the future. On timeout it rethrows TimeoutException with this message, appending the original timeout text and the measured elapsed milliseconds (System.currentTimeMillis() - start) so operators can compare requested vs actual wait.","triggerScenarios":"sendSync-style calls (TM begin/commit, RM register/undo-report) where the peer does not answer within timeoutMillis: TC busy in GC or long store operations, network latency, or the response lost after a connection reset.","commonSituations":"Default RPC timeout too low for the deployment (store.db slow queries on TC), TC paused by full GC, k8s CPU throttling of the TC pod, or bursty load making commit round-trips exceed the configured timeout.","solutions":["Raise the client RPC timeouts (e.g. seata.client.tm.commit-retry-timeout / default-transaction-group timeout, rm/tm rpc timeout in ms) to comfortably exceed observed p99 round-trips.","Fix TC-side latency: tune the store (db pool, index on global/branch table), check GC logs, give TC adequate CPU.","Verify network RTT and MTU between client and TC; eliminate lossy links or saturated NICs.","Ensure the transaction group -> TC endpoint mapping is correct so requests are not silently routed to a dead node."],"exampleFix":"# before\ntm.degrade-check=false\ndefault-global-transaction-timeout=60000\n# after: raise rpc timeout and fix tc store latency\ntm.default-global-transaction-timeout=120000\n# plus: dbstore connection pool sizing on tc","handlingStrategy":"retry","validationCode":"// preflight: confirm TC reachable and rpc timeout comfortably above RTT p99 before beginning the global tx\nif (!tcHealthCheck(1000)) { deferOrRouteToHealthyTC(); }\nassert configuredRpcTimeoutMillis > 5 * measuredP99Rtt : \"rpc timeout too tight\";","typeGuard":null,"tryCatchPattern":"catch (TimeoutException e) {\n    long cost = parseCost(e.getMessage());\n    if (cost >= configuredTimeout) { // genuine timeout: retry idempotent ops once with backoff\n        retryWithBackoff(this::idempotentRpc, 2, 500);\n    } else { escalateToInfra(e); }\n}","preventionTips":["Set rpc timeouts from measured p99, not defaults","Monitor TC store latency and GC pauses","Keep global transactions small enough to finish well under the timeout"],"tags":["timeout","rpc","network","performance"],"backgroundTag":null,"analyzedSha":"e01f97c6db397165050caa6764020410c2c8199a","analyzedAt":"2026-08-14T10:23:53.097Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}