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 AbortPolicyWithReport Semaphore lock not released #13609

Merged
merged 1 commit into from
Jan 8, 2024

Conversation

CycleMaker
Copy link
Contributor

#13605

What is the purpose of the change

fix AbortPolicyWithReport Semaphore lock not released

Brief changelog

image

@codecov-commenter
Copy link

codecov-commenter commented Jan 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (1bdbfd8) 70.37% compared to head (842772d) 70.38%.
Report is 1 commits behind head on 3.2.

Additional details and impacted files
@@            Coverage Diff             @@
##              3.2   #13609      +/-   ##
==========================================
+ Coverage   70.37%   70.38%   +0.01%     
==========================================
  Files        1606     1606              
  Lines       69997    70001       +4     
  Branches    10098    10099       +1     
==========================================
+ Hits        49260    49271      +11     
+ Misses      16111    16099      -12     
- Partials     4626     4631       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -158,6 +158,7 @@ private void dumpJStack() {
}
// To avoid multiple dump, check again
if (System.currentTimeMillis() - lastPrintTime < TEN_MINUTES_MILLS) {
guard.release();
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can move

        if (System.currentTimeMillis() - lastPrintTime < TEN_MINUTES_MILLS) {
            guard.release();
            return;
        }

        ExecutorService pool = Executors.newSingleThreadExecutor();

into try-finally block

Copy link
Contributor Author

@CycleMaker CycleMaker Jan 4, 2024

Choose a reason for hiding this comment

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

sorry,I didn't unstand.I haven't realized the advantages of moving these codes into try-finally block.
is this what you means?

    if (!guard.tryAcquire()) {
        return;
    }
    
    ExecutorService pool;
    try {
        // To avoid multiple dump, check again
        if (System.currentTimeMillis() - lastPrintTime < TEN_MINUTES_MILLS) {
            guard.release();
            return;
        }
        pool = Executors.newSingleThreadExecutor();
        ...........

Copy link
Member

Choose a reason for hiding this comment

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

guard can be released in the finally block

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, please take another look.

Copy link

sonarcloud bot commented Jan 5, 2024

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

1 New issue
0 Security Hotspots
85.7% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

@AlbumenJ AlbumenJ merged commit 670f997 into apache:3.2 Jan 8, 2024
18 checks passed
wxbty added a commit to wxbty/dubbo that referenced this pull request Jan 9, 2024
Will-well pushed a commit to Will-well/dubbo that referenced this pull request Jan 31, 2024
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