Bug 1711 - 2 inner class breakpoints lead to weird state (1GJUZ1Y)
Summary: 2 inner class breakpoints lead to weird state (1GJUZ1Y)
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Joe Szurszewski CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-10 22:18 EDT by Joe Szurszewski CLA
Modified: 2001-10-16 16:46 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joe Szurszewski CLA 2001-10-10 22:18:02 EDT
PRODUCT VERSION:
135 Sun JDK1.2.2

JGS (9/10/01 5:22:48 PM)
	In InnerAnon scenario class, set breakpoints in nextElement() methods
	in both inner classes.  Debug, and notice that the debugger is in a weird state
	where neither of the breakpoints was hit (as evidenced by console output),
	but DebugView still shows all threads as running with "unknown" labels.
	One of the breakpoints is shown as installed, the other isn't.
	If if you disable the line 38 breakpoint, you successfully stop at the line
	25 breakpoint, but the program never terminates.  If you try it the other way 
	around, back to weird state.

DS (9/13/01 3:56:37 PM)
	Cannot reproduce on 135 (or 135++).

JGS (9/13/01 4:26:41 PM)
	Can still reproduce on 135 under Sun JDK1.2.2.  Cannot reproduce under
	IBM VM or Sun JDK1.3.  Under 1.2.2, following walkback appears:

com.sun.jdi.VMDisconnectedException: Got IOException from Virtual Machine
	at org.eclipse.jdi.internal.connect.PacketReceiveManager.getReply(PacketReceiveManager.java:116)
	at org.eclipse.jdi.internal.connect.PacketReceiveManager.getReply(PacketReceiveManager.java:130)
	at org.eclipse.jdi.internal.MirrorImpl.requestVM(MirrorImpl.java:155)
	at org.eclipse.jdi.internal.MirrorImpl.requestVM(MirrorImpl.java:173)
	at org.eclipse.jdi.internal.MirrorImpl.requestVM(MirrorImpl.java:188)
	at org.eclipse.jdi.internal.ThreadReferenceImpl.resume(ThreadReferenceImpl.java:292)
	at org.eclipse.jdi.internal.event.EventSetImpl.resumeThreads(EventSetImpl.java:104)
	at org.eclipse.jdi.internal.event.EventSetImpl.resume(EventSetImpl.java:86)
	at org.eclipse.jdt.internal.debug.core.EventDispatcher.dispatch(EventDispatcher.java:104)
	at org.eclipse.jdt.internal.debug.core.EventDispatcher$1.run(EventDispatcher.java:136)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1197)
	at org.eclipse.jdt.internal.debug.core.EventDispatcher.run(EventDispatcher.java:153)
	at java.lang.Thread.run(Thread.java:498)

DS (9/13/01 4:54:15 PM)
	Not reliably reproduceable...takes me 1 in 10.  Timing problem.  Are we trying to talk to a VM too
	early?  Appears to be a JDI problem. Should figure out what event is causing the problem.

JGS (9/13/01 5:25:01 PM)
	Problem is a SocketException trying to read reply from telling thread to resume (JdwpCommandPacket
	is TR_RESUME).  

	Added tracing to PacketManager to dump out each event.  The first block is for a succesful run:

Event=VMStartEvent: 0
Event=ThreadStartEvent: 5
Event=ClassPrepareEvent: 7
Event=ClassPrepareEvent: 11
Event=ClassPrepareEvent: 10
Event=ClassPrepareEvent: 11
Event=ClassPrepareEvent: 10
Event=BreakpointEvent: 13
Event=BreakpointEvent: 13
Event=BreakpointEvent: 13
Event=ClassPrepareEvent: 11
Event=ClassPrepareEvent: 10
Event=BreakpointEvent: 14
Event=BreakpointEvent: 14
Event=BreakpointEvent: 14
Event=ThreadDeathEvent: 6
Event=ThreadStartEvent: 5
Event=VMDisconnectEvent: 0

	Next block is what we get when the problem happens:

Event=VMStartEvent: 0
Event=ThreadStartEvent: 5
Event=ClassPrepareEvent: 7
Event=ClassPrepareEvent: 11
Event=ClassPrepareEvent: 10
Event=ClassPrepareEvent: 11
Event=ClassPrepareEvent: 10
com.sun.jdi.VMDisconnectedException: Got IOException from Virtual Machine
	at org.eclipse.jdi.internal.connect.PacketReceiveManager.getReply(PacketReceiveManager.java:116)
	at org.eclipse.jdi.internal.connect.PacketReceiveManager.getReply(PacketReceiveManager.java:130)
	at org.eclipse.jdi.internal.MirrorImpl.requestVM(MirrorImpl.java:155)
	at org.eclipse.jdi.internal.MirrorImpl.requestVM(MirrorImpl.java:173)
	at org.eclipse.jdi.internal.MirrorImpl.requestVM(MirrorImpl.java:188)
	at org.eclipse.jdi.internal.ThreadReferenceImpl.resume(ThreadReferenceImpl.java:292)
	at org.eclipse.jdi.internal.event.EventSetImpl.resumeThreads(EventSetImpl.java:104)
	at org.eclipse.jdi.internal.event.EventSetImpl.resume(EventSetImpl.java:86)
	at org.eclipse.jdt.internal.debug.core.EventDispatcher.dispatch(EventDispatcher.java:105)
	at org.eclipse.jdt.internal.debug.core.EventDispatcher$1.run(EventDispatcher.java:137)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1197)
	at org.eclipse.jdt.internal.debug.core.EventDispatcher.run(EventDispatcher.java:154)
	at java.lang.Thread.run(Thread.java:498)

	So it appears the resume after a ClassPrepareEvent is causing the problem.

JGS (9/13/01 5:43:56 PM)
	Source for InnerAnon follows:


import java.util.*;

public class InnerAnon {
     private Object[] stuff;
     private static String description = "foo";
     private int answer = 42;

     public class Inner implements Enumeration {
         private int count;
         private Object[] contents;

         public Inner(Object[] cont) {
              contents = cont;
              count = 0;
         }

         public boolean hasMoreElements() {
              if (count < contents.length) {
                  return true;
              }
              return false;
         }

         public Object nextElement() {
              return contents[count++];   // Set one breakpoint here
         }
     }

     public static Enumeration Anon(final Object[] cont) {

         return new Enumeration() {
              final int[] c = {0};
              public boolean hasMoreElements() {
                  return c[0] < cont.length;
              }

              public Object nextElement() {
                  return cont[c[0]++];   // Set the second breakpoint here
              }
         };
     }

     public InnerAnon(){
         stuff = new Object[] {new String("one"),
              new String("two"), new String("three")};
     }

     public static void main(String[] args) {
         InnerAnon ia = new InnerAnon();
         Enumeration enum = ia.new Inner(ia.stuff);
         ia.printEnum(enum);
         enum = Anon(ia.stuff);
         ia.printEnum(enum);
     }

     public static void printEnum(Enumeration e) {
         final char lastLetter = 'z';
         while (e.hasMoreElements()) {
              System.out.println((String)e.nextElement());
         }
     }
}
Comment 1 Darin Wright CLA 2001-10-15 12:05:12 EDT
Joe, is this still a problem in 204++?
Comment 2 Joe Szurszewski CLA 2001-10-16 16:44:29 EDT
This is still a problem in 204, generating the same walkback.
Note this is only a problem under Sun 1.2.2., not under the IBM VM or under Sun 
1.3.0.
Comment 3 Darin Wright CLA 2001-10-16 16:46:20 EDT
This is a VM dependent problem. We do not intend to fix.