[X] 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();
}
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:
So, Power of AI! And we're encouraged to utilize them.
Before Creating the Bug Report
[X] I found a bug, not just asking a question, which should be created in GitHub Discussions.
[X] I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.
[X] 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.
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:
So, Power of AI! And we're encouraged to utilize them.