JDK-8168002 : Internal Exception while invoking StackFrameImpl methods
  • Type: Bug
  • Component: core-svc
  • Sub-Component: debugger
  • Affected Version: 8u101
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: x86
  • Submitted: 2016-10-13
  • Updated: 2016-10-14
  • Resolved: 2016-10-14
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
1.8.0_101-b13

ADDITIONAL OS VERSION INFORMATION :
OS X El Capitan V10.11.6

A DESCRIPTION OF THE PROBLEM :
Scenario :- Debugging a JavaScript code which is executed using the Nashorn engine. 

When the JVM reaches a breakpoint, we use the ThreadReference instance and cycle through StackFrame instances in the thread fetching the variables.

Variables visible in a StackFrame instance are procured by invoking the method visibleVariables() on the instance. 

The value of variables are got via the 'getValues()' method. 


During the above two invocations in multiple instances, the below Internal Exception showed up in the console preventing the code from getting the values in a StackFrame. 

com.sun.jdi.InternalException: Unexpected JDWP Error: 35
	at com.sun.tools.jdi.JDWPException.toJDIException(JDWPException.java:65)
	at com.sun.tools.jdi.StackFrameImpl.getValues(StackFrameImpl.java:241)
	at com.ca.liveapicreator.debugger.holder.VMSession.getFrames(VMSession.java:183)
	at com.ca.liveapicreator.debugger.holder.VMSession.getCurrentThread(VMSession.java:110)
	at com.ca.liveapicreator.debugger.DebugEventListener.handleBreakpointEvent(DebugEventListener.java:249)
	at com.ca.liveapicreator.debugger.DebugEventListener.run(DebugEventListener.java:100)
	at java.lang.Thread.run(Thread.java:745)



The code in VMSession.java looks like below. 


					// Get variables.
					List<LocalVariable> variables = stackFrame.visibleVariables();
					if (!variables.isEmpty()) {
						// Create frames if there are any visible variables.
						Map<LocalVariable, Value> values;
						try {
							values = stackFrame.getValues(variables);  // EXCEPTION during INVOCATION.
						}
						catch (InternalException ie) {
							/*
							 *  Handling the Oracle JDI error. http://bugs.java.com/bugdatabase/view_bug.do?bug_id=7164236
							 *  Move on to the next frame.
							 */
							continue;
						}
						frames.add(new MyFrame(this, stackFrame, location, variables, values, frameIndex));
					}
				 

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Debug a JavaScript code executed in Nashorn using JDI. This bug could not be consistently reproduced as it occurs occasionally. 

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
StackFrame.getValues() method invocation to return the values of the variables in the frame without throwing an exception. 

ERROR MESSAGES/STACK TRACES THAT OCCUR :
com.sun.jdi.InternalException: Unexpected JDWP Error: 35
	at com.sun.tools.jdi.JDWPException.toJDIException(JDWPException.java:65)
	at com.sun.tools.jdi.StackFrameImpl.getValues(StackFrameImpl.java:241)
	at com.myclass.debugger.VMSession.getFrames(VMSession.java:183)
	at com.myclass.debugger..VMSession.getCurrentThread(VMSession.java:110)
	at com.myclass.debugger.DebugEventListener.handleBreakpointEvent(DebugEventListener.java:249)
	at com.myclass.debugger.DebugEventListener.run(DebugEventListener.java:100)
	at java.lang.Thread.run(Thread.java:745)

REPRODUCIBILITY :
This bug can be reproduced occasionally.

CUSTOMER SUBMITTED WORKAROUND :
Workaround here was to skip that frame and move on to the next one. 


Comments
This issue is duplicate of JDK-7164236 which is in open state. Closing as duplicate of JDK-7164236
14-10-2016