Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.0] Fixed the problem that the service was offline for a long time without re-registration #10200

Merged
merged 4 commits into from Jul 4, 2022

Conversation

icodening
Copy link
Contributor

What is the purpose of the change

fix bug #10181

Brief changelog

make EventThread non-blocking to fix bug #10181

ref PR: #10182

@codecov-commenter
Copy link

codecov-commenter commented Jun 22, 2022

Codecov Report

Merging #10200 (b694024) into 3.0 (b68f114) will increase coverage by 0.00%.
The diff coverage is 86.95%.

@@            Coverage Diff            @@
##                3.0   #10200   +/-   ##
=========================================
  Coverage     65.69%   65.70%           
+ Complexity      297      296    -1     
=========================================
  Files          1233     1233           
  Lines         53710    53732   +22     
  Branches       8107     8111    +4     
=========================================
+ Hits          35285    35302   +17     
- Misses        14595    14600    +5     
  Partials       3830     3830           
Impacted Files Coverage Δ
...ting/zookeeper/curator/CuratorZookeeperClient.java 71.73% <86.95%> (+2.50%) ⬆️
...ian2/dubbo/AbstractHessian2FactoryInitializer.java 50.00% <0.00%> (-11.12%) ⬇️
...ng/transport/dispatcher/all/AllChannelHandler.java 62.06% <0.00%> (-6.90%) ⬇️
...dubbo/remoting/exchange/support/DefaultFuture.java 87.17% <0.00%> (-5.13%) ⬇️
...e/dubbo/rpc/protocol/tri/transport/WriteQueue.java 73.80% <0.00%> (-4.77%) ⬇️
.../dubbo/registry/client/metadata/MetadataUtils.java 67.32% <0.00%> (-3.97%) ⬇️
...bo/rpc/protocol/dubbo/DecodeableRpcInvocation.java 70.19% <0.00%> (-3.85%) ⬇️
...he/dubbo/remoting/transport/netty/NettyServer.java 70.17% <0.00%> (-3.51%) ⬇️
.../apache/dubbo/remoting/transport/CodecSupport.java 80.30% <0.00%> (-3.04%) ⬇️
.../registry/zookeeper/ZookeeperServiceDiscovery.java 68.35% <0.00%> (-2.54%) ⬇️
... and 13 more

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 b68f114...b694024. Read the comment docs.

@icodening
Copy link
Contributor Author

reason not to use org.apache.dubbo.common.threadpool.manager.FrameworkExecutorRepository#getSharedExecutor: If a lot of callbacks are retried, many temporary threads will be created.

@AlbumenJ
Copy link
Member

reason not to use org.apache.dubbo.common.threadpool.manager.FrameworkExecutorRepository#getSharedExecutor: If a lot of callbacks are retried, many temporary threads will be created.

you can use org.apache.dubbo.common.threadpool.manager.FrameworkExecutorRepository#nextExecutorExecutor

@icodening
Copy link
Contributor Author

if other modules reuse the same thread pool, it may delay the execution of tasks of other modules when Curator block retry, just like the stack below, the blocked threads are replaced by nextExecutorExecutor threads

"main-EventThread" #17 daemon prio=5 os_prio=31 tid=0x00007fb4792fa000 nid=0xa203 waiting on condition [0x0000700004c0b000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
    at java.lang.Thread.sleep(Native Method)
    at java.lang.Thread.sleep(Thread.java:340)
    at java.util.concurrent.TimeUnit.sleep(TimeUnit.java:386)
    at org.apache.curator.RetryLoop$1.sleepFor(RetryLoop.java:75)
    at org.apache.curator.retry.SleepingRetry.allowRetry(SleepingRetry.java:46)
    at org.apache.curator.retry.RetryNTimes.allowRetry(RetryNTimes.java:24)
    at org.apache.curator.RetryLoop.takeException(RetryLoop.java:174)
    at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:70)
    at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:100)
    at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:228)
    at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:219)
    at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:41)
    at org.apache.dubbo.remoting.zookeeper.curator.CuratorZookeeperClient$CuratorWatcherImpl.process(CuratorZookeeperClient.java:341)
    at org.apache.curator.framework.imps.NamespaceWatcher.process(NamespaceWatcher.java:83)
    at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:533)
    at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:508)

@AlbumenJ
Copy link
Member

If the executor cannot be managed through the executor repository, the isolated executor should be in lazy initialization mode and destroyed on shutdown.

@icodening
Copy link
Contributor Author

get , i have solved it, pls review

@AlbumenJ AlbumenJ merged commit f9c6651 into apache:3.0 Jul 4, 2022
AlbumenJ pushed a commit that referenced this pull request Jul 6, 2022
…without re-registration (#10200)

* 修复因网络抖动导致服务长时间下线没有重新注册的问题

* lazy init CuratorWatcher executor and destroyed on shutdown

* add lock on close
@AlbumenJ AlbumenJ added this to the 3.0.10 milestone Jul 16, 2022
@icodening icodening deleted the bugfix_zk_3.0 branch December 26, 2022 08:09
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.

None yet

3 participants