Please review the following small test fix. Test `SuspendResume3.java` can 
deadlock due to `worker2` being suspended at the wrong place. This can happen 
because `arriveAndAwaitAdvance()` may trigger additional class 
loading/initialization, during which the thread can also appear as `BLOCKED` 
and thus be suspended later on. If the main thread tries to access those same 
classes before resuming `worker2` then the test will deadlock. I added the 
specific scenario involving class `ForkJoinPool` to JBS including the relevant 
stack traces.

The fix is to use the management API to check `worker2` is blocked on the 
specific monitor.

The issue was observed by running local tests. I was able to reproduce it 
locally and verified the issue is now fixed.

Thanks,
Patricio

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

Commit messages:
 - v1

Changes: https://git.openjdk.org/jdk/pull/30199/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=30199&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8379795
  Stats: 26 lines in 1 file changed: 25 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/30199.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/30199/head:pull/30199

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

Reply via email to