RFR: 7122: Rules evaluation never complete
Alex Macdonald
aptmac at openjdk.java.net
Wed Jul 28 20:08:44 UTC 2021
This PR addresses JMC-7122 [[0]](https://bugs.openjdk.java.net/browse/JMC-7122), in which certain rules (mainly GC) do not finish evaluation.
This occurs when the `result` [[1]](https://github.com/aptmac/jmc/blob/master/application/org.openjdk.jmc.flightrecorder.ui/src/main/java/org/openjdk/jmc/flightrecorder/ui/RuleManager.java#L133) of a rule is never updated, and still holds it's initialized value of `IN_PROGRESS` despite exiting the evaluation loop. What happens in the case of the 4 GC rules listed in the bug report (**1**. GCs Caused by System.gc(), **2**. GCs Caused by Heap Inspection, **3**. GC Stall, **4**. GCs Caused by GC Locker) is that they have a dependency on `GarbageCollectionInfoRule`, which ends up being ignored [[2]](https://github.com/aptmac/jmc/blob/master/application/org.openjdk.jmc.flightrecorder.ui/src/main/java/org/openjdk/jmc/flightrecorder/ui/RuleManager.java#L164) because it doesn't match the event availability map. As a result, the 4 GC rules cause `shouldEvaluate(rule)` [[3]](https://github.com/aptmac/jmc/blob/master/application/org.openjdk.jmc.flightrecorder.ui/src/main/java/org/openjdk/jmc/f
lightrecorder/ui/RuleManager.java#L143) to return false, but because the result value was already initialized it isn't caught by the subsequent if-statements.
In this approach, the conditional is adjusted to check the event availability map and `shouldEvaluate()` at the same time, because if either of them are false we should ignore that rule.
Before:

After:

[0] https://bugs.openjdk.java.net/browse/JMC-7122
[1] https://github.com/aptmac/jmc/blob/master/application/org.openjdk.jmc.flightrecorder.ui/src/main/java/org/openjdk/jmc/flightrecorder/ui/RuleManager.java#L133
[2] https://github.com/aptmac/jmc/blob/master/application/org.openjdk.jmc.flightrecorder.ui/src/main/java/org/openjdk/jmc/flightrecorder/ui/RuleManager.java#L164
[3] https://github.com/aptmac/jmc/blob/master/application/org.openjdk.jmc.flightrecorder.ui/src/main/java/org/openjdk/jmc/flightrecorder/ui/RuleManager.java#L143
-------------
Commit messages:
- 7122: Rules evaluation never complete
Changes: https://git.openjdk.java.net/jmc/pull/291/files
Webrev: https://webrevs.openjdk.java.net/?repo=jmc&pr=291&range=00
Issue: https://bugs.openjdk.java.net/browse/JMC-7122
Stats: 21 lines in 1 file changed: 2 ins; 3 del; 16 mod
Patch: https://git.openjdk.java.net/jmc/pull/291.diff
Fetch: git fetch https://git.openjdk.java.net/jmc pull/291/head:pull/291
PR: https://git.openjdk.java.net/jmc/pull/291
More information about the jmc-dev
mailing list