> The test 
> [java/util/concurrent/locks/Lock/OOMEInAQS.java](https://github.com/openjdk/jdk/blob/master/test/jdk/java/util/concurrent/locks/Lock/OOMEInAQS.java)
>  timed out when run with "-XX:-TieredCompilation 
> -XX:+UnlockDiagnosticVMOptions -XX:CompileThresholdScaling=0.01" flags.
> 
> The test checks that AQS-based locks, conditions, and `CountDownLatches` do 
> not fail when encountering OOME. It intentionally fills Java heap to get OOME.
> 
> With `-XX:CompileThresholdScaling=0.01` C2 compiles test's code and scalarize 
> new `ConditionNode` object in 
> `AbstractQueuedSynchronizer::newConditionNode()` using 
> `ReduceAllocationMerges` optimization.
> 
> One of test's worker threads executes compiled code and hit uncommon trap. 
> During deoptimization scalarized object rematerialization failed (heap is 
> full) and VM throws OOME. The affected inlined frames are popped because we 
> can't execute them without materialized objects (see 
> [InterpreterRuntime::exception_handler_for_exception()](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/interpreter/interpreterRuntime.cpp#L522)).
>  As result, the inlined OOME handler is bypassed.
> 
> The test worker thread which hit deoptimization exits through "catch 
> (Throwable ex)" path without notifying other worker threads which hang on 
> "cond.await()" and we got timeout.
> 
> I suggest using an allocation's JVMstate information to walk through inlined 
> frames and check for OOME handlers. Don't eliminate the allocation If we find 
> such handler.  Narrow this condition only for `ReduceAllocationMerges` 
> optimization for this fix. I concern that general solution may introduce a 
> performance regression.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Vladimir Kozlov has updated the pull request incrementally with one additional 
commit since the last revision:

  Revert some changes

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/33197/files
  - new: https://git.openjdk.org/jdk/pull/33197/files/e2942772..52cf757c

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=33197&range=07
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=33197&range=06-07

  Stats: 5 lines in 2 files changed: 0 ins; 3 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/33197.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/33197/head:pull/33197

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

Reply via email to