apache / apache/dubbo

dubbo 3.x 中 `dubbo.reference.*`,`dubbo.service.*` 等属性服覆盖导致配置不生效问题

Open
#11,508 2 comments 0 reactions 0 assignees View on GitHub
type/bug
Dominant language
Java
Stars
41.6k
Forks
26.4k
Avg merge
15h 13m
Merged PRs (30d)
4

Description

- [x] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate.

### Environment

* Dubbo version: 3.1.4
* Operating System version: mac os
* Java version: 1.8

### Steps to reproduce this issue

仓库地址 https://github.com/web1992/demo-dubbo3x-overwrite

dubbo 3.x 中 `dubbo.reference.*`,`dubbo.service.*` 等属性服覆盖导致配置不生效问题复现。

1. 启动 com.gbdmf.demo.dubbo3.EmbeddedZooKeeper
2. 启动 com.gbdmf.demo.dubbo3.xml.provider.DubboXmlProviderApplication
3. 启动 com.gbdmf.demo.dubbo3.xml.consumer.DubboXmlConsumerApplication

启动项目发现consumer中配置的超时时间没有生效!

在 dubbo-consumer.xml 中配置了接口`com.gbdmf.demo.dubbo3.api.GreetingsService`
的超时时间`6000`ms,但是如果我在 DubboXmlConsumerApplication 文件中设置了
`System.setProperty("dubbo.reference.timeout", "3000")` 系统变量,那么在 xml 中设置的超时时间就会被覆盖了。导致超时时间设置不生效。

此问题是在dubbo 3.x 中才出现的问题,这个会导致项目中的接口配置的超时时间都会失效。而且问题很难排查。

此外我用了 nacos 这样的配置中心,如果在 nacos 的配置中心,配置了公共的配置,比如`dubbo.reference.timeout=3000` 这个命名规范刚好满足了dubbo 属性的覆盖规则。那么就影响了所有的服务!

> 目前在服务升级3.x 的时候就遇到了这个问题。

目前的解决方式展示查找项目中所有这样的配置,改掉。但是成本很大

超时日志
```log
... 30 more
Caused by: org.apache.dubbo.remoting.TimeoutException: Waiting server-side response timeout by scan timer. start time: 2023-02-08 11:57:30.556, end time: 2023-02-08 11:57:33.594, client elapsed: 42 ms, server elapsed: 2996 ms, timeout: 3000 ms, request: Request [id=0, version=2.0.2, twoWay=true, event=false, broken=false, data=RpcInvocation [methodName=sayHi, parameterTypes=[class java.lang.String]]], channel: /10.16.51.27:63220 -> /10.16.51.27:20881
at org.apache.dubbo.remoting.exchange.support.DefaultFuture.doReceived(DefaultFuture.java:222)
at org.apache.dubbo.remoting.exchange.support.DefaultFuture.received(DefaultFuture.java:186)
at org.apache.dubbo.remoting.exchange.support.DefaultFuture$TimeoutCheckTask.notifyTimeout(DefaultFuture.java:305)
at org.apache.dubbo.remoting.exchange.support.DefaultFuture$TimeoutCheckTask.lambda$run$0(DefaultFuture.java:292)
at org.apache.dubbo.common.threadpool.ThreadlessExecutor$RunnableWrapper.run(ThreadlessExecutor.java:184)
at org.apache.dubbo.common.threadpool.ThreadlessExecutor.waitAndDrain(ThreadlessExecutor.java:103)
at org.apache.dubbo.rpc.AsyncRpcResult.get(AsyncRpcResult.java:194)
... 35 more
```

Contributor guide

Open the contributing guide

Research direction

Start with the linked demo-dubbo3x-overwrite reproduction and follow the three startup steps using Dubbo 3.1.4. Compare the timeout from dubbo-consumer.xml with the System.setProperty("dubbo.reference.timeout", "3000") value and determine the intended precedence for these configuration sources. Done should include a regression test showing that interface-specific XML configuration is not unexpectedly overridden.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.