Skip to content

[Dubbo-2191] add timeout config to zookeeper client#2217

Merged
diecui1202 merged 1 commit intoapache:masterfrom
htynkn:bug/fix-time-out-param-missing-in-reg
Aug 9, 2018
Merged

[Dubbo-2191] add timeout config to zookeeper client#2217
diecui1202 merged 1 commit intoapache:masterfrom
htynkn:bug/fix-time-out-param-missing-in-reg

Conversation

@htynkn
Copy link
Copy Markdown
Member

@htynkn htynkn commented Aug 7, 2018

What is the purpose of the change

Add timeout config for zookeeper registry
Fix #2191
Close #1743

Brief changelog

Read timeout config from url and set to client

Verifying this change

CI pass

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a GITHUB_issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a GITHUB issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [Dubbo-XXX] Fix UnknownException when host config not exist #XXX. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in test module.
  • Run mvn clean install -DskipTests & mvn clean test-compile failsafe:integration-test to make sure unit-test and integration-test pass.
  • If this contribution is large, please follow the Software Donation Guide.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Aug 7, 2018

Codecov Report

Merging #2217 into master will decrease coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2217      +/-   ##
============================================
- Coverage     54.61%   54.58%   -0.03%     
+ Complexity     5152     5148       -4     
============================================
  Files           569      569              
  Lines         25031    25033       +2     
  Branches       4456     4456              
============================================
- Hits          13671    13665       -6     
- Misses         9320     9326       +6     
- Partials       2040     2042       +2
Impacted Files Coverage Δ Complexity Δ
...ng/zookeeper/zkclient/ZkclientZookeeperClient.java 59.52% <100%> (+0.98%) 10 <0> (ø) ⬇️
...ting/zookeeper/curator/CuratorZookeeperClient.java 62.16% <100%> (+0.51%) 12 <0> (ø) ⬇️
...onfig/spring/extension/SpringExtensionFactory.java 75% <0%> (-10.72%) 10% <0%> (ø)
...rpc/protocol/dubbo/telnet/InvokeTelnetHandler.java 51.89% <0%> (-3.8%) 10% <0%> (-3%)
...he/dubbo/remoting/transport/netty/NettyServer.java 67.85% <0%> (-3.58%) 8% <0%> (-1%)
...org/apache/dubbo/rpc/filter/ActiveLimitFilter.java 83.33% <0%> (ø) 6% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7345582...eccb59b. Read the comment docs.

public ZkclientZookeeperClient(URL url) {
super(url);
client = new ZkClientWrapper(url.getBackupAddress(), 30000);
long timeout = url.getParameter("timeout", 30000L);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe make 30000 to be a constant like org.apache.dubbo.common.Constants#DEFAULT_TIMEOUT is better ?
How do u think about it.
:)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have DEFAULT_TIMEOUT in Constants with value 1000, we also have DEFAULT_REGISTRY_CONNECT_TIMEOUT which has been commented out with value 5000.

Another thing is in ZkclientZookeeperClient.java timeout is 30000 but in CuratorZookeeperClient.java timeout is 5000.

so I prefer to keep those value in code and make sure existing user will not have unexpected behaviour when upgrade version

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.
That make sense

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请问为什么每次启动时都会报连接超时啊,但是能正常启动

public ZkclientZookeeperClient(URL url) {
super(url);
client = new ZkClientWrapper(url.getBackupAddress(), 30000);
long timeout = url.getParameter("timeout", 30000L);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also the key "timeout".
:)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sense. this one can replace by TIMEOUT_KEY

@carryxyh
Copy link
Copy Markdown
Member

carryxyh commented Aug 8, 2018

Also fix this issue:
#1743

Remember to close this issue after merging this pr.
:)

@diecui1202
Copy link
Copy Markdown

It LGTM.

@diecui1202 diecui1202 merged commit 9f21b9f into apache:master Aug 9, 2018
@htynkn htynkn deleted the bug/fix-time-out-param-missing-in-reg branch August 9, 2018 08:25
@shijunsong
Copy link
Copy Markdown

hi, i am using the dependency is
<dependency> <groupId>com.alibaba.boot</groupId> <artifactId>dubbo-spring-boot-starter</artifactId> </dependency>
,which had been solved the bug?

Look forward to your favourable reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

org.apache.curator.ConnectionState - Connection timed out for connection use CuratorFrameworkFactory.DEFAULT_CONNECTION_TIMEOUT_MS

6 participants