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

Cleanup and throw exception if bind failed #12987

Merged
merged 7 commits into from
Sep 1, 2023
Merged

Conversation

AlbumenJ
Copy link
Member

What is the purpose of the change

Brief changelog

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.

@codecov-commenter
Copy link

codecov-commenter commented Aug 31, 2023

Codecov Report

Merging #12987 (4bc16fe) into 3.2 (c12a57e) will increase coverage by 0.67%.
Report is 2 commits behind head on 3.2.
The diff coverage is n/a.

@@              Coverage Diff              @@
##                3.2   #12987       +/-   ##
=============================================
+ Coverage     68.78%   69.45%    +0.67%     
+ Complexity      341        2      -339     
=============================================
  Files          3659     1649     -2010     
  Lines        171227    68513   -102714     
  Branches      28256    10001    -18255     
=============================================
- Hits         117770    47589    -70181     
+ Misses        43281    16330    -26951     
+ Partials      10176     4594     -5582     

see 2048 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Throwable lastError = null;
int retryTimes = getUrl().getParameter(Constants.BIND_RETRY_TIMES, 10);
int retryInterval = getUrl().getParameter(Constants.BIND_RETRY_INTERVAL, 3000);
for (int i = 0; i < retryTimes; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why would we need binding retry, what's the problem with throwing exception directly on binding failure.

Copy link
Member Author

Choose a reason for hiding this comment

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

Such 20880, 22222... are in ip_local_port_range and can be used as a tcp client port. If there is someone requesting remoting using 20880 as client port(allocated by kernel), Dubbo will bind failed.

@AlbumenJ AlbumenJ changed the title Retry bind if bind failed Cleanup and throw exception if bind failed Sep 1, 2023
if (qosCheck) {
throw new IllegalStateException("Fail to start qos server: " + throwable.getMessage(), throwable);
throw new RpcException(throwable);
Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessary wrap, how about throw it directly.

Copy link
Contributor

@chickenlj chickenlj left a comment

Choose a reason for hiding this comment

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

LGTM.

@chickenlj chickenlj merged commit 0bfd54c into apache:3.2 Sep 1, 2023
@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 1, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

53.7% 53.7% Coverage
0.0% 0.0% Duplication

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.

4 participants