RFR: 8348268: Test gc/shenandoah/TestResizeTLAB.java#compact: fatal error: Before Updating References: Thread C2 CompilerThread1: expected gc-state 9, actual 21 [v2]

William Kemper wkemper at openjdk.org
Tue Feb 11 19:31:09 UTC 2025


On Mon, 10 Feb 2025 21:54:51 GMT, William Kemper <wkemper at openjdk.org> wrote:

>> Non-java threads were not having their gc-state configured when they attach. If they were created before the verifier's safepoint, but after the iteration over non-java threads, they would not have the correct state.
>
> William Kemper has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Hold the thread lock when concurrently changing gc state

That's right. The `on_thread_attach` callback and the thread being added to the list of threads _does_ happen under the `Thread_lock`, by the handshake mechanism (and the java thread iterator) do _not_ take the thread lock. In this particular assertion violation, the thread received a stale `gc_state` when it attached (before the control thread even entered `concurrent_prepare_for_update_refs`), however, the control thread executed the handshake _before_ the recently attached thread was actually added to the java thread list.

I will update the comment and add an assert in `set_gc_state_concurrent`.

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

PR Comment: https://git.openjdk.org/jdk/pull/23428#issuecomment-2651866466


More information about the shenandoah-dev mailing list