RFR: 8324983: race in CompileBroker::possibly_add_compiler_threads

David Holmes dholmes at openjdk.org
Thu Feb 1 07:11:02 UTC 2024


On Wed, 31 Jan 2024 21:35:05 GMT, Tom Rodriguez <never at openjdk.org> wrote:

> The number of active compiler threads is decremented before the compiler thread has actually activated so possibly_add_compiler_thread might start a new thread on the existing JavaThread.  This adds a check that it's really exiting before proceeding and some new guarantees that ensure threads aren't started on top running threads.

Changes requested by dholmes (Reviewer).

src/hotspot/share/runtime/javaThread.cpp line 748:

> 746:   // to complete once we've done the notify_all below. Needs a release() to obey Java Memory Model
> 747:   // requirements.
> 748:   guarantee(java_lang_Thread::thread(threadObj()) == thread, "must be alive");

Please make this an assert rather than a guarantee. Only compiler threads can potentially violate this so we should not pay the price of the check for every thread .

src/hotspot/share/runtime/javaThread.cpp line 2160:

> 2158:   // JavaThread* is already visible to JVM/TI via the ThreadsList.
> 2159: 
> 2160:   guarantee(java_lang_Thread::thread(thread_oop()) == nullptr, "must not be alive");

Again please make this an assert.

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

PR Review: https://git.openjdk.org/jdk/pull/17662#pullrequestreview-1855688640
PR Review Comment: https://git.openjdk.org/jdk/pull/17662#discussion_r1473889733
PR Review Comment: https://git.openjdk.org/jdk/pull/17662#discussion_r1473890558


More information about the hotspot-dev mailing list