imjyz opened a new issue, #15829: URL: https://github.com/apache/dubbo/issues/15829
### Pre-check - [x] I am sure that all the content I provide is in English. ### Search before asking - [x] I had searched in the [issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no similar issues. ### Apache Dubbo Component Java SDK (apache/dubbo) ### Dubbo Version Dubbo java 3.2.5, Open jdk 1.8 ### Steps to reproduce this issue Consider three applications: A, B, and C, with the following call chain: **A → (3s timeout) → B → (6s timeout) → C** Application A has enable-timeout-countdown=true configured, which enables timeout propagation to downstream services. In service B, when calling C using Dubbo’s built-in asynchronous mode: ```java @DubboReference(async = "true", timeout = 6000) private CService cService; cService.sayHello("world"); ``` the effective timeout is correctly adjusted to less than 3 seconds, respecting the remaining time from the upstream caller (see Timeout Configuration Documentation). However, if B invokes C via a plain CompletableFuture.supplyAsync(), like this: ```java CompletableFuture<String> future3 = CompletableFuture.supplyAsync(() -> { return asyncService.invoke("invoke call request3"); }); ``` the timeout remains 6 seconds, because the Dubbo context (including the timeout countdown) is not propagated to the new thread. ### What you expected to happen I’m unsure whether this is a bug. I believe the timeout for async calls shouldn’t be modified automatically. If it’s by design, the correct way to write async invocations should be standardized and documented. ### Anything else Core code: org.apache.dubbo.rpc.support.RpcUtils#calculateTimeout ```java Object countdown = RpcContext.getClientAttachment().getObjectAttachment(TIME_COUNTDOWN_KEY); if (countdown == null) { ...... } else { TimeoutCountDown timeoutCountDown = (TimeoutCountDown) countdown; timeout = (int) timeoutCountDown.timeRemaining(TimeUnit.MILLISECONDS); // pass timeout to remote server invocation.setObjectAttachment(TIMEOUT_ATTACHMENT_KEY, timeout); } ``` ### Are you willing to submit a pull request to fix on your own? - [x] Yes I am willing to submit a pull request on my own! ### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
