RFR: 7248: JMC7/8 Automated Analysis taking very long time to produce results for Class Leak Rule. [v2]
Brice Dutheil
github.com+803621+bric3 at openjdk.java.net
Thu Aug 19 07:54:27 UTC 2021
On Tue, 27 Jul 2021 14:37:52 GMT, Suchita Chaturvedi <schaturvedi at openjdk.org> wrote:
>> This PR addresses the optimization of Class Leak Rule.
>>
>> Please refer the JBS for the sample JFR which was taking ~90 minutes to generate results for Class Leak Rule. After the optimization time is reduced to ~10-15 minutes.
>>
>> Please review the change and let me the know if there are any comments / suggestions.
>
> Suchita Chaturvedi has updated the pull request incrementally with one additional commit since the last revision:
>
> Calculation maximum timeout is set via preference and hardcoding removed.
core/org.openjdk.jmc.flightrecorder.rules.jdk/src/main/java/org/openjdk/jmc/flightrecorder/rules/jdk/util/DefaultIItemResultSet.java line 135:
> 133: }
> 134: // Timeout can be configured in prefrences (default value is set to 5 minutes)
> 135: exec.awaitTermination(ClassLeakingRule.CONFIGURED_TIMEOUT, TimeUnit.MINUTES);
After re-reading this code I don't think `awaitTermination` is enough to terminate the ongoing tasks ; i.e. this call will block until either all tasks are finished or until the given time-out. This means that JMC may still have hanging threads doing some work in this anonymous thread pool.
I believe this statement should be followed by `exec.shutdownNow()` and making the runnables cooperate in this shutdown by checking the thread interrupt status in the for loops. E.g.
if (Thread.currentThread().isInterrupted()) return;
-------------
PR: https://git.openjdk.java.net/jmc/pull/248
More information about the jmc-dev
mailing list