Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 549444

Summary: (Java 8?) Future Threads not being started after stopping at a breakpoint
Product: [Eclipse Project] JDT Reporter: Anthony Cole <anthony.cole.2>
Component: DebugAssignee: JDT-Debug-Inbox <jdt-debug-inbox>
Status: CLOSED NOT_ECLIPSE QA Contact:
Severity: normal    
Priority: P3 CC: stephan.herrmann
Version: 4.12   
Target Milestone: 4.13 M3   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Screenshot of the debug menu none

Description Anthony Cole CLA 2019-07-20 19:59:39 EDT
Created attachment 279348 [details]
Screenshot of the debug menu

Overview:
It appears that threads attempting to be started after a breakpoint was hit and the JVM was improperly resumed will not start. This can also cause the JVM to not shut down properly due to pending shutdown hooks.

Reproduce:
1. Insert this code in a new project:


public class Test {
	public static void main(String[] args) {
		System.out.println("Before");
		new Thread(() -> System.out.println("In")).start();
		System.out.println("After");
	}
}


2. Set breakpoint on the first System.out.println line.
3. Run in Debug mode.
4. The debug menu auto-selects the main method of the main thread. (screenshot 1)
5. Press "Resume", it only resumes the current thread. Other threads appear to stay paused. The main thread very quickly terminates, but that does not matter - same result when sleeping. (screenshot 2).
6. Realize you only resumed one thread, select the session (the node containing all threads, all of which now are stopped) and pause it, so you can resume it.
7. After pausing and resuming the session is still active but no threads are shown. (screenshot 3)

(If you select the session at 4. and resume it everything works normally.)

Actual results:
No "In" was ever printed, yet the thread is not a daemon and the JVM has not shut down.

Expected result:
Stopping at a breakpoint and failing to resume the session instead of only the thread should not block new threads from starting, especially after the whole session was stopped and resumed again. "In" should be printed.


JDK 1.8.0_172
works in 11.0.2
Comment 1 Stephan Herrmann CLA 2019-07-21 04:26:37 EDT
To me this sounds like one of:
- wrong expectation regarding the execution of Futures, or
- a bug in your JVM (1.8)

Closing as NOT_ECLIPSE.
Feel free to re-open if you can provide evidence that JDT should do something differently (what? how?).