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

[Bug/Typo] Write lock not released in IndexStoreService #8688

Open
3 tasks done
imzs opened this issue Sep 12, 2024 · 0 comments
Open
3 tasks done

[Bug/Typo] Write lock not released in IndexStoreService #8688

imzs opened this issue Sep 12, 2024 · 0 comments

Comments

@imzs
Copy link
Contributor

imzs commented Sep 12, 2024

Before Creating the Bug Report

  • I found a bug, not just asking a question, which should be created in GitHub Discussions.

  • I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.

  • I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.

Runtime platform environment

All

RocketMQ version

5.x

JDK Version

All

Describe the Bug

I run the unit test of our local branch, but found that the test can't be finished after all test passed.
After a long time of debugging step by step, I found this.

} catch (Exception e) {
       log.error("IndexStoreService force upload error", e);
       throw new RuntimeException(e);
} finally {
       readWriteLock.writeLock().lock();
}

I would call it a typo rather than a bug.

Steps to Reproduce

What Did You Expect to See?

What Did You See Instead?

Additional Context

Well, let's talk about something else.

This weakness is classified as [Incomplete Cleanup], see details in
https://cwe.mitre.org/data/definitions/459

Why didn't we find it early? Is there any tool to help? Sonar plugin or Github Copilot?

As a rule based static code analysis tool, SonarLint failed to find this bug. I've not aware of SonarCloud and SonarQube, since I didn't try them. The java rule set can be found here
https://rules.sonarsource.com/java/

What's more interesting and exciting is, LLMs seem to solve this easily. I've tried several of them, result like this:
image

So, Power of AI! And we're encouraged to utilize them.

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

No branches or pull requests

1 participant