[prev in list] [next in list] [prev in thread] [next in thread]
List: openjdk-serviceability-dev
Subject: Integrated: 8290200: com/sun/jdi/InvokeHangTest.java fails with "Debuggee appears to be hung"
From: Chris Plummer <cjplummer () openjdk ! org>
Date: 2023-03-21 18:03:50
Message-ID: RT_jdp2XU5VlzTA150hAvr-hHB9DGJIvJzZ9Op4w9MA=.ab5abfb0-cdb4-449d-b2d2-7d311a272630 () github ! com
[Download RAW message or body]
On Thu, 16 Mar 2023 21:02:09 GMT, Chris Plummer <cjplummer@openjdk.org> wrote:
> The debuggee main method creates two threads and then starts them:
>
>
> public static void main(String[] args) {
> System.out.println("Howdy!");
> Thread t1 = TestScaffold.newThread(new InvokeHangTarg(), name1);
> Thread t2 = TestScaffold.newThread(new InvokeHangTarg(), name2);
>
> t1.start();
> t2.start();
> }
>
>
> These threads will hit breakpoints which the debugger handles and issues an invoke \
> on the breakpoint thread. The threads run until they generate 100 breakpoints. \
> There is an issue when these two threads are virtual threads. Virtual threads are \
> daemon threads. That means the JVM can exit while they are still running. The above \
> main() method is not waiting for these two threads to exit, so main() exits \
> immediately and the JVM starts the shutdown process. It first must wait for all \
> non-daemon threads to exit, but there are none, so the JVM exits right away before \
> the two threads are completed. The end result of this early exit is that sometimes \
> the invoke done by the debugger never completes because the JVM has already issued \
> a VMDeath event and the debuggee has been disconnected.
> When these two threads are platform threads, the JVM has to wait until they \
> complete before it exits, so they will always complete. The fix for virtual threads \
> is to do a join with t1 and t2. This forces the main() method to block until they \
> have completed.
This pull request has now been integrated.
Changeset: 0deb6489
Author: Chris Plummer <cjplummer@openjdk.org>
URL: https://git.openjdk.org/jdk/commit/0deb648985b018653ccdaf193dc13b3cf21c088a
Stats: 20 lines in 2 files changed: 12 ins; 2 del; 6 mod
8290200: com/sun/jdi/InvokeHangTest.java fails with "Debuggee appears to be hung"
Reviewed-by: amenkov, lmesnik, sspitsyn, dcubed
-------------
PR: https://git.openjdk.org/jdk/pull/13068
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic