Integrated: 8324881: ObjectSynchronizer::inflate(Thread* current...) is invoked for non-current thread

Axel Boldt-Christmas aboldtch at openjdk.org
Wed Feb 7 15:52:05 UTC 2024


On Tue, 30 Jan 2024 10:03:41 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:

> The `ObjectSynchronizer` has always assumed that the `current` parameters are both the current thread as well as the thread that is doing the locking. The only time that we are entering on behalf of another thread is when doing re-locking in deoptimization. This has worked because the deoptee thread is suspended. However ResourceMarks have been using the wrong thread when logging is enabled.
> 
> This change `ObjectSynchronizer` instruments the relevant methods with both a `JavaThread* locking_thread` as well as `[Java]Thread* current` to be able to use the correct thread for ResourceMarks. 
> 
> Having the `inflate` care about a `locking_thread` is a little unpleasant in my opinion. But it is required for LM_LIGHTWEIGHT. 
> Would probably be cleaner if the inflate for LM_LIGHTWEIGHT was it's own thing, as it does not share the whole INFLATING protocol. But seems like a future RFE to refactor this code.
> 
> Can reproduce a crash by modifying `test/jdk/com/sun/jdi/EATests.java` and using `-XX:DiagnoseSyncOnValueBasedClasses=2` with LM_LEGACY or running `test/jdk/com/sun/jdi/EATests.java` with LM_LIGHTWEIGHT/LM_MONITOR and `-Xlog:monitorinflation=trace`. 
> 
> Could extend this test to capture this regression in the future (or creating a new test based on the same infrastructure). Will give it an attempt, so we have a regression test for this. But these tests get rather involved as the require a lot of jvmti setup.

This pull request has now been integrated.

Changeset: a3a2b1fb
Author:    Axel Boldt-Christmas <aboldtch at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/a3a2b1fbbf00577ce1d0e3a44e9537e997b30b05
Stats:     362 lines in 6 files changed: 304 ins; 10 del; 48 mod

8324881: ObjectSynchronizer::inflate(Thread* current...) is invoked for non-current thread

Reviewed-by: rrich, dholmes, coleenp, dcubed

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

PR: https://git.openjdk.org/jdk/pull/17626


More information about the hotspot-dev mailing list