Bug 4576 - Thread suspend/resume errors in classes with the "same" name
Summary: Thread suspend/resume errors in classes with the "same" name
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 2.0   Edit
Hardware: PC Linux
: P1 normal (vote)
Target Milestone: ---   Edit
Assignee: Darin Wright CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 5083 5234 (view as bug list)
Depends on:
Blocks:
 
Reported: 2001-10-11 14:19 EDT by Jared Burns CLA
Modified: 2001-10-25 09:35 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jared Burns CLA 2001-10-11 14:19:15 EDT
This bug was exposed as a result of the fix for installing breakpoints in too
many classes (a breakpoint in class Hello would result in a breakpoint being
installed in Hello2). It appears to have been merely exposed by the fix, not
caused by it.

1. Create the two classes which follow and place breakpoints where indicated in
comments.
2. Debug Hello to the first breakpoint.
3. Click resume.
4. Note that the second breakpoint is not hit.
Alternatively:
1. Same as above.
2. Same as above.
3. Step over the System.out call and the instantiation of Hello2
4. Note that after stepping over the instantiation, the thread was somehow
resumed such that the call to Hello2#foo() is made and the breakpoint in Hello2
is hit.

public class Hello() {

	public static void main(String[] args) {
		Hello h= new Hello();
		h.foo();
	}

	public void foo() {
		System.out.println("Foo!"); // place breakpoint here
		Hello2 h2= new Hello2();
		h2.foo();
	}
}

public class Hello2 {

	public void foo() {
		System.out.println("Foo2!"); // place breakpoint here
	}

}
Comment 1 Darin Wright CLA 2001-10-13 23:38:37 EDT
In the latest code stream, I have no problem. I recently changed the
implementation of stepping/dropping, etc. I do not know if I fixed
this as a side effect.

Comment 2 Jared Burns CLA 2001-10-17 14:33:49 EDT
The bug still exists when I try the example on Linux. I tested this on WinNT,
however, and it worked correctly.

Seems this is a Linux-only bug?
Comment 3 Jared Burns CLA 2001-10-17 18:25:15 EDT
We've managed to reproduce this bug on Windows, but only while debugging it
(with breakpoints in the host).
We suspect we've found the root of the problem: Two sets of ClassLoadEvents are
being fired when Hello2() is loaded.
Suspect the event flow is:
1. Receive ClassLoadEventSet. Install breakpoints, resume thread.
2. Receive BreakpointEvent. Handle as usual.
3. Receive duplicate ClassLoadEventSet. Reinstall breakpoints, resume thread.
No sooner has the breakpoint been hit, than we are resuming the thread.
Investigation continues.
Comment 4 Jared Burns CLA 2001-10-18 14:27:49 EDT
It wasn't that we were receiving multiple EventSets for the class load, but that
we were resuming the same thread for each event in the EventSet. So the
interaction looked like:
- VM suspends
- VM fires ClassLoadEvent set (2 events)
- EventDispatcher handles event set and calls EventSet.resume()
- EventSetImpl, iterating over the events in the set, resumes the thread for the
first class load event.
- Thread resumes on VM and hits a breakpoint
- VM suspends and fires breakpoint event
- EventSetImpl, still iterating over the events in the set, resumes the thread
(again) for the second class load event
- VM resumes and hits the second breakpoint

The EventSetImpl has been fixed to fire only one resume event per thread per
call to EventSetImpl#resumeThreads()
Comment 5 Jared Burns CLA 2001-10-18 14:28:03 EDT
Please verify.
Comment 6 Darin Wright CLA 2001-10-18 16:24:46 EDT
Verified.
Comment 7 Darin Wright CLA 2001-10-19 11:44:34 EDT
*** Bug 5083 has been marked as a duplicate of this bug. ***
Comment 8 Darin Wright CLA 2001-10-25 09:35:15 EDT
*** Bug 5234 has been marked as a duplicate of this bug. ***