| Summary: | [18] Project Loom (virtual threads) support | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Andrey Loskutov <loskutov> | ||||||||
| Component: | Debug | Assignee: | JDT-Debug-Inbox <jdt-debug-inbox> | ||||||||
| Status: | CLOSED MOVED | QA Contact: | |||||||||
| Severity: | enhancement | ||||||||||
| Priority: | P3 | CC: | jinbwan, sarika.sinha | ||||||||
| Version: | 4.20 | ||||||||||
| Target Milestone: | --- | ||||||||||
| Hardware: | All | ||||||||||
| OS: | All | ||||||||||
| See Also: | https://github.com/eclipse-jdt/eclipse.jdt.debug/issues/38 | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
|
Description
Andrey Loskutov
Created attachment 285922 [details]
VirtualThread in VariablesView
I get to see the Virtual thread in Variables view and inspect.
Created attachment 285923 [details]
Debug view with Virtual thread
Debug view with Virtual thread
@Andrey, Did you observe the same ? (In reply to Sarika Sinha from comment #3) > @Andrey, > Did you observe the same ? Now, with the new build, yes: https://download.java.net/java/early_access/loom/5/openjdk-17-loom+5-191_linux-x64_bin.tar.gz So breakpoints on virtual threads seem to work now. (In reply to Andrey Loskutov from comment #4) > So breakpoints on virtual threads seem to work now. Also not in all places, and other things don't work too. Step over/step return don't work, and "drop to frame" shows an InvalidStackFrameException. At stopped breakpoint, just try to use step over/step return - nothing happens. Now suspend and see the code hangs in VirtualThread$VThreadContinuation(Continuation).yield0(ContinuationScope, Continuation) line: 438. public void run() { try { Thread.sleep(Duration.ofSeconds(10)); // put a breakpoint here String x = "Hello"; System.out.println(x); queue.put("done: " + number); // put another breakpoint here } catch (InterruptedException e) { } } In the snippet, create "another" breakpoint like shown above. Debugger can't show the system stopped at the second breakpoint at all (but the JVM suspended). OK, found out that breakpoints after sleep() don't work: public void run() { try { String x = "Hello"; // put a breakpoint here System.out.println(x); Thread.sleep(Duration.ofSeconds(10)); System.out.println(x + x); // put another breakpoint here queue.put("done: " + number); } catch (InterruptedException e) { } } One can debug as expected from the first breakpoint, but after JVM reached Thread.sleep() call, no further debugging with the current thread possible. (In reply to Andrey Loskutov from comment #5) > (In reply to Andrey Loskutov from comment #4) > > So breakpoints on virtual threads seem to work now. > > Also not in all places, and other things don't work too. > > Step over/step return don't work, and "drop to frame" shows an > InvalidStackFrameException. > > At stopped breakpoint, just try to use step over/step return - nothing > happens. Now suspend and see the code hangs in > VirtualThread$VThreadContinuation(Continuation).yield0(ContinuationScope, > Continuation) line: 438. > > public void run() { > try { > Thread.sleep(Duration.ofSeconds(10)); // put a breakpoint here > String x = "Hello"; > System.out.println(x); > queue.put("done: " + number); // put another breakpoint here > } catch (InterruptedException e) { } > } > > In the snippet, create "another" breakpoint like shown above. Debugger can't > show the system stopped at the second breakpoint at all (but the JVM > suspended). > > OK, found out that breakpoints after sleep() don't work: > > public void run() { > try { > String x = "Hello"; // put a breakpoint here > System.out.println(x); > Thread.sleep(Duration.ofSeconds(10)); > System.out.println(x + x); // put another breakpoint here > queue.put("done: " + number); > } catch (InterruptedException e) { } > } > > One can debug as expected from the first breakpoint, but after JVM reached > Thread.sleep() call, no further debugging with the current thread possible. Same observation. If we step into thread sleep it works ok. Basically If we reach java.lang.VirtualThread.sleepNanos(long) and then resume it works fine. Another observation: int maxThreads = 16; Our debugger is responsive for breakpoints and sleep till the count of 16. If we increase the count to 17 or more, it cannot comeback from Stepping or any such operation. Created github issue for future work: https://github.com/eclipse-jdt/eclipse.jdt.debug/issues/38 |