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

Fix forkingclusterinvoker npe #9612

Closed

Conversation

codeimport
Copy link
Contributor

@codeimport codeimport commented Jan 22, 2022

What is the purpose of the change

fix #9582
When the cluster uses the forking mode and the provider side all times out ,consumer side will npe

Brief changelog

org.apache.dubbo.rpc.cluster.support.ForkingClusterInvoker
org.apache.dubbo.rpc.cluster.support.ForkingClusterInvokerTest

Verifying this change

Checklist

  • Make sure there is a GitHub_issue field 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.
  • 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.
  • Check if is necessary to patch to Dubbo 3 if you are work on Dubbo 2.7
  • 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 sample in dubbo samples project.
  • Add some description to dubbo-website project if you are requesting to add a feature.
  • GitHub Actions works fine on your own branch.
  • If this contribution is large, please follow the Software Donation Guide.

When the cluster uses the forking mode and the provider side all times out, the poll method used in forkingClusterInvoker will time out earlier than the provider side, so it will get null from the queue and throw NPE in the subsequent process. The poll method here should not set the timeout time, but wait for the provider to timeout. When the provider times out, the poll method will correctly obtain an RpcException

@codecov-commenter
Copy link

codecov-commenter commented Jan 22, 2022

Codecov Report

Merging #9612 (ec78ca1) into 3.0 (b8a1398) will increase coverage by 0.08%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##                3.0    #9612      +/-   ##
============================================
+ Coverage     65.66%   65.75%   +0.08%     
  Complexity      297      297              
============================================
  Files          1189     1189              
  Lines         51824    51823       -1     
  Branches       7843     7843              
============================================
+ Hits          34032    34077      +45     
+ Misses        14117    14076      -41     
+ Partials       3675     3670       -5     
Impacted Files Coverage Δ
...bbo/rpc/cluster/support/ForkingClusterInvoker.java 86.84% <100.00%> (-0.34%) ⬇️
...ting/zookeeper/curator/CuratorZookeeperClient.java 68.75% <0.00%> (-1.93%) ⬇️
...pache/dubbo/registry/support/AbstractRegistry.java 75.35% <0.00%> (-1.06%) ⬇️
...rg/apache/dubbo/common/timer/HashedWheelTimer.java 85.56% <0.00%> (+0.34%) ⬆️
.../dubbo/registry/integration/RegistryDirectory.java 49.24% <0.00%> (+0.37%) ⬆️
...ubbo/registry/client/AbstractServiceDiscovery.java 89.56% <0.00%> (+1.73%) ⬆️
...exchange/support/header/HeaderExchangeHandler.java 62.83% <0.00%> (+1.76%) ⬆️
...ing/zookeeper/curator/Curator5ZookeeperClient.java 69.56% <0.00%> (+1.93%) ⬆️
.../registry/zookeeper/ZookeeperServiceDiscovery.java 84.12% <0.00%> (+3.17%) ⬆️
...apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java 64.80% <0.00%> (+3.28%) ⬆️
... and 6 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 b8a1398...ec78ca1. Read the comment docs.

Copy link
Member

@wangchengming666 wangchengming666 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@juzi214032 juzi214032 left a comment

Choose a reason for hiding this comment

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

I don't think it's reasonable to make the queue wait indefinitely, which may generate some unknown exceptions, and a reasonable way would be to reverse the relevant exception message when the ret is empty

@AlbumenJ
Copy link
Member

AlbumenJ commented Feb 6, 2022

Agree with @juzi214032

@chickenlj chickenlj mentioned this pull request Mar 15, 2022
8 tasks
@chickenlj
Copy link
Contributor

solved by #9613

@chickenlj chickenlj closed this Mar 15, 2022
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.

[2.7.8],使用Forking Cluster报空指针异常
6 participants