On Fri, 27 Nov 2020 02:26:44 GMT, David Holmes <dhol...@openjdk.org> wrote:
>> The ServiceThread cleaning used a stale ObjectFree state when calling >> remove_dead_entries, because another thread had concurrently set is_enabled >> to false. Add a lock around setting/resetting the lock event state and >> retest the state under a lock. Ran the test 100s of time without failure, >> where otherwise it fails very quickly. >> Tested with tier2,3 and running tiers 4,5,6 in progress. >> Thanks to Kim for his previous feedback. > > src/hotspot/share/prims/jvmtiTagMap.cpp line 1162: > >> 1160: if (_needs_cleaning) { >> 1161: // Recheck whether to post object free events under the lock. >> 1162: post_object_free = post_object_free && >> env()->is_enabled(JVMTI_EVENT_OBJECT_FREE); > > Where is `is_enabled` called without the lock being held in a caller of > `remove_dead_entries()`? void JvmtiTagMap::flush_object_free_events() { assert_not_at_safepoint(); if (env()->is_enabled(JVMTI_EVENT_OBJECT_FREE)) { Called by JVMTI to disable events and called by the service thread. And here for get_objects_with_tags: if (collector.some_dead_found() && env()->is_enabled(JVMTI_EVENT_OBJECT_FREE)) { post_dead_objects_on_vm_thread(); } ------------- PR: https://git.openjdk.java.net/jdk/pull/1439