RFR: 8271353: PerfDataManager::destroy crashes in VM_Exit

David Holmes dholmes at openjdk.java.net
Wed Jul 28 05:29:28 UTC 2021


On Tue, 27 Jul 2021 23:37:58 GMT, Xin Liu <xliu at openjdk.org> wrote:

> This patch check PerfDataManager::_sampled and _constants is NULL. if it is,
> return -1. 
> 
> When the user enables UL `-Xlog:perf+datacreation=debug`, it may crash in
> PerfDataManager::destroy(). The following line will crash when _sampled is NULL.
> 
> 
>   log_debug(perf, datacreation)("Total = %d, Sampled = %d, Constants = %d",
>                                 _all->length(), _sampled->length(), _constants->length());
> 
> 
> This only happens when UsePerfData is on and PerfDataManager::destroy() is invoked before
> StatSampler::initialize() which initializes PerfDataManager::_sampled.
> PerfDataManager::destroy() is called by VM_Exit which can be triggered by SIGINT on Linux anytime.
> 
> A reproducible: invoke the following command and keep pressing Ctrl-c.
> $perf stat -r 100 java -Xlog:perf+datacreation=debug --version

The additional NULL checks seem fine and trivial.

Thanks,
David

-------------

Marked as reviewed by dholmes (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/4913


More information about the hotspot-runtime-dev mailing list