RFR: 8366659: ObjectMonitor::wait() can deadlock with a suspension request [v8]

Patricio Chilano Mateo pchilanomate at openjdk.org
Tue Nov 18 21:41:43 UTC 2025


On Mon, 17 Nov 2025 19:30:44 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> Maybe I do not fully understand the question, but isn't it what differentiates test case 2 from test case 3?
>
> Sorry, I wasn't very clear. I'm questioning the need for the 200ms delay since our call
> to `wait4ContendedEnter` will already delay the calling thread. Since @pchilano requested
> the addition of the 200ms delay, he should probably chime in here.

We need it because the `notify()` call already changes the state of the waiter to the BLOCKED state [1] (note that it doesn't unpark it). That means this call to `wait4ContendedEnter` will always return immediately (except for the rare case of the wait timing out before the notify call).

[1] https://github.com/openjdk/jdk/blob/27a38d9093958ae4851bc61b8d3f0d71dc780823/src/hotspot/share/runtime/objectMonitor.cpp#L2077

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27040#discussion_r2539670920


More information about the serviceability-dev mailing list