Closed JayBerlin closed 7 years ago
Actually, I included the exception here because I thought it might be interesting to see the actual reason. There is a case right above this one for AbsentInformationException
where the exception is excluded since it doesn't contribute anything.
Are you seeing an error here? If so, which one?
Here is an example of an error with the stack trace:
08:57:07.723 [pool-1-thread-1] DEBUG c.p.ncd.nashorn.NashornDebuggerHost - Script reference type: jdk.nashorn.internal.scripts.Script$102$\^function\_ (5 attempts left)
08:57:07.728 [pool-1-thread-1] WARN c.p.ncd.nashorn.NashornDebuggerHost - Failed to get line locations for jdk.nashorn.internal.scripts.Script$102$\^function\_
com.sun.jdi.AbsentInformationException: null
at com.sun.tools.jdi.ReferenceTypeImpl.allLineLocations(ReferenceTypeImpl.java:862)
at com.sun.tools.jdi.ReferenceTypeImpl.allLineLocations(ReferenceTypeImpl.java:838)
at com.programmaticallyspeaking.ncd.nashorn.NashornDebuggerHost.$anonfun$considerReferenceType$4(NashornDebuggerHost.scala:415)
at scala.util.Try$.apply(Try.scala:209)
at com.programmaticallyspeaking.ncd.nashorn.NashornDebuggerHost.considerReferenceType(NashornDebuggerHost.scala:415)
at com.programmaticallyspeaking.ncd.nashorn.NashornDebuggerHost.scanOutstandingClasses(NashornDebuggerHost.scala:486)
at com.programmaticallyspeaking.ncd.nashorn.NashornDebuggerHost.scanClasses(NashornDebuggerHost.scala:472)
at com.programmaticallyspeaking.ncd.nashorn.NashornDebuggerHost.handleOperation(NashornDebuggerHost.scala:754)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.programmaticallyspeaking.ncd.infra.ExecutorProxy$Handler.$anonfun$invoke$3(ExecutorProxy.scala:42)
at scala.util.Try$.apply(Try.scala:209)
at com.programmaticallyspeaking.ncd.infra.ExecutorProxy$Handler.$anonfun$invoke$2(ExecutorProxy.scala:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Huh, weird that you're not hitting this case:
case Failure(t: AbsentInformationException) =>
// Don't log the exception in this case, it's not useful.
log.warn(s"Failed to get line locations for ${refType.name}")
None
I specifically added that failure case because I came to the same conclusion as you - the AIE stack trace is useless. When I added it, I got rid of the stack trace. Let me check again.
Hmmm. Good point, now that I go back and look at the code it should have been caught above.
I just checked again to make sure. Without the AIE case, I get the stack trace. With it, I don't. The target is running on Java 9 and so is NCDbg. What's your setup?
Ah. I am running Java 8 for both. I don't have Java 9 installed on my Mac.
Which version? I don't recall getting that error with Java 8, but I will test it.
I tried NCDbg with 144 and the debug target with 131 and didn't get the stack trace.
I was running 74 (must have been left setup from some previous testing). I set to 131 and did not have the issue.
Thanks!
Ok, good! Closing this then.
In NashornDebuggerHost.scala:435, the stack is being logged for a warning and does not provide much useful information:
I would like to suggest that this be changed to not log the stack:
I can create a PR for this if you want.