RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v50]
Patricio Chilano Mateo
pchilanomate at openjdk.org
Wed Jun 4 18:57:09 UTC 2025
On Wed, 4 Jun 2025 14:39:47 GMT, Johannes Bechberger <jbechberger at openjdk.org> wrote:
>> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 430:
>>
>>> 428: void JfrCPUTimeThreadSampling::create_sampler(double rate, bool auto_adapt) {
>>> 429: assert(_sampler == nullptr, "invariant");
>>> 430: _sampler = new JfrCPUSamplerThread(rate, auto_adapt);
>>
>> If we start a recording on an already running process we have a race here where a new thread can create and set its timer before we call init_timers() where the signal handler is installed. In that case the program will terminate with message “Profiling timer expired" (default action for SIGPROF). It can be easily reproduced by adding a delay here and starting a recording on a simple test that just creates new threads. We need to add some extra check in create_timer_for_thread() or install the signal handler earlier.
>
> I created a `has_timer` flag that is checked by `create_timer_for_thread()` before creating timers and set by `init_timers`. Is this what you envisioned?
Thanks, I verified that fixes the issue.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127238263
More information about the hotspot-dev
mailing list