-
Notifications
You must be signed in to change notification settings - Fork 173
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
7231: JMC createReport for JMC8 Automated Analysis fails to evaluate several rules #311
Conversation
👋 Welcome back aptmac! A progress list of the required criteria for merging this PR into |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I'd prefer @Gunde to review this.
It could be worth getting this particular fix into an 8.1.1 release. |
...der.rules/src/main/java/org/openjdk/jmc/flightrecorder/rules/messages/internal/Messages.java
Show resolved
Hide resolved
...ightrecorder.rules/src/main/java/org/openjdk/jmc/flightrecorder/rules/util/RulesToolkit.java
Show resolved
Hide resolved
...ightrecorder.rules/src/main/java/org/openjdk/jmc/flightrecorder/rules/util/RulesToolkit.java
Outdated
Show resolved
Hide resolved
...rc/main/resources/org/openjdk/jmc/flightrecorder/rules/messages/internal/messages.properties
Show resolved
Hide resolved
...recorder.rules.test/src/test/java/org/openjdk/jmc/flightrecorder/rules/RulesToolkitTest.java
Show resolved
Hide resolved
/reviewers 2 |
@thegreystone |
* provider of configuration values used by the ResultBuilder | ||
* @return a completed future containing an evaluation error result | ||
*/ | ||
private static Future<IResult> evaluationErrorResult(IRule rule, IPreferenceValueProvider preferences) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be slightly confusing that this is labeled with "error" if the rule evaluation did not fail, just did not take place. It could probably just be a N/A result instead, which we should already have methods for in RulesToolkit.
boolean shouldEvaluate = true; | ||
for (IRule unavailableRule : unavailableRules) { | ||
if (dependencyName.equals(unavailableRule.getId())) { | ||
shouldEvaluate = false; | ||
resultFutures.put(rule, evaluationErrorResult(rule, preferences)); | ||
break; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not enough to determine whether or not a rule should be evaluated. The @dependsOn
annotation specifies both a class and an optional minimum severity that the prior rule must return for the current rule to evaluate. If we disregard this we risk running into NPEs for later rules as they attempt to access results that might not be present in the RulesProvider.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, thanks for pointing that out. I'll put a severity check into there similar to how it's done in RuleManager: https://github.com/openjdk/jmc/blob/master/application/org.openjdk.jmc.flightrecorder.ui/src/main/java/org/openjdk/jmc/flightrecorder/ui/RuleManager.java#L114
I've incorporated Henrik's review comments into this latest commit. The first addressed change is making use of The second addressed change is to take the dependency's result severity value into account when evaluating a rule. On the UI side, this is done by Lastly I tried to reorganize the code a bit so it should be easier to keep track of the rules (with dependencies), their dependencies, and the computed result of these dependencies. |
@aptmac This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 2 new commits pushed to the Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
/integrate |
This PR addresses JMC-7231 [0], in which using
JfrHtmlRulesReport
throws a number of exceptions and fails to evaluate a handful of rules.I used some of the review comments [1] that I made in the other open PR to address the same issue.
As far as I can tell, there are two main issues here.
The first is some rules now (after the Rules 2.0 update) have dependencies, these are (4)
GcLockerRule
,GcStallRule
,HeapInspectionRule
, andSystemGcRule
which depend onGarbageCollectionInfoRule
. The problem here is that ifGarbageCollectionInfoRule
isn't evaluated then the other four rules end up throwing an NPE while trying to evaluate.The second issue is that as of Rules 2.0, on the jmc.ui Automated Analysis page we use
RulesToolkit.matchesEventAvailabilityMap()
to verify is an event is is available and if the rule should be evaluated. This check wasn't replicated on thecore
implementation, so I've added it in. What's interesting here is that in the test jfr I was using,GarbageCollectionInfoRule
was filtered out bymatchesEventAvailabilityMap()
, which was causing the above 4 Gc rules to explode.The solution I've put together uses two lists to track 1). rules that are unavailable due to being filtered out by
matchesEventAvailabilityMap()
, and 2). rules that have dependencies. It later loops through the list of rules with dependencies, and checks to see if they exist in the list with unavailable rules. If a rule is not able to be evaluated by either 1). not being available or 2). by having a dependency that is not available, it returns a completed futureIResult
containing "not available", similar to how on this is handled on the jmc.ui side. Then the rest of the rules report proceeds as usual.I think the easiest way to verify/try this fix is by creating a run configuration for JfrHtmlRulesReport in Eclipse, and feeding it a jfr file.
[0] https://bugs.openjdk.java.net/browse/JMC-7231
[1] #302 (review)
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jmc pull/311/head:pull/311
$ git checkout pull/311
Update a local copy of the PR:
$ git checkout pull/311
$ git pull https://git.openjdk.java.net/jmc pull/311/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 311
View PR using the GUI difftool:
$ git pr show -t 311
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jmc/pull/311.diff