On Wed, 4 Jun 2025 13:47:01 GMT, Patricio Chilano Mateo <pchilanom...@openjdk.org> wrote:
>> Johannes Bechberger has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Fix build > > 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? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126783367