provegard / ncdbg

A debugger for Nashorn that uses Chrome DevTools as frontend
BSD 3-Clause "New" or "Revised" License
31 stars 5 forks source link

Object was garbage collected #62

Closed provegard closed 7 years ago

provegard commented 7 years ago

During code evaluation:

[2017-09-06T21:45:12.089458600Z] [StackBuilder][ERROR]: Object was garbage collected
null
  at jdk.jdi/com.sun.tools.jdi.JDWPException.toJDIException(JDWPException.java:45)
  at jdk.jdi/com.sun.tools.jdi.ObjectReferenceImpl.referenceType(ObjectReferenceImpl.java:157)
  at jdk.jdi/com.sun.tools.jdi.ObjectReferenceImpl.validateAssignment(ObjectReferenceImpl.java:613)
  at jdk.jdi/com.sun.tools.jdi.ObjectReferenceImpl.prepareForAssignmentTo(ObjectReferenceImpl.java:585)
  at jdk.jdi/com.sun.tools.jdi.ValueImpl.prepareForAssignment(ValueImpl.java:48)
  at jdk.jdi/com.sun.tools.jdi.MethodImpl.validateAndPrepareArgumentsForInvoke(MethodImpl.java:386)
  at jdk.jdi/com.sun.tools.jdi.ObjectReferenceImpl.invokeMethod(ObjectReferenceImpl.java:411)
  at com.programmaticallyspeaking.ncd.nashorn.DynamicInvoker.$anonfun$applyDynamic$3(DynamicInvoker.scala:142)
  at com.programmaticallyspeaking.ncd.nashorn.Invoker.unpackError(DynamicInvoker.scala:100)
  at com.programmaticallyspeaking.ncd.nashorn.DynamicInvoker.$anonfun$applyDynamic$2(DynamicInvoker.scala:142)
  at com.programmaticallyspeaking.ncd.nashorn.VirtualMachineExtensions$ExtVirtualMachine.withoutClassPrepareRequests(VirtualMachineExtensions.scala:21)
  at com.programmaticallyspeaking.ncd.nashorn.DynamicInvoker.applyDynamic(DynamicInvoker.scala:142)
  at com.programmaticallyspeaking.ncd.nashorn.CodeEval.DebuggerSupport_eval_custom(CodeEval.scala:61)
  at com.programmaticallyspeaking.ncd.nashorn.CodeEval.eval(CodeEval.scala:14)
  at com.programmaticallyspeaking.ncd.nashorn.CodeEval.eval(CodeEval.scala:10)
  at com.programmaticallyspeaking.ncd.nashorn.StackBuilder.$anonfun$buildStackFramesSequence$7(StackBuilder.scala:189)
  at com.programmaticallyspeaking.ncd.nashorn.NashornDebuggerHost.evaluateOnStackFrame(NashornDebuggerHost.scala:1112)
  at com.programmaticallyspeaking.ncd.nashorn.NashornDebuggerHost.$anonfun$evaluateOnStackFrame$3(NashornDebuggerHost.scala:1127)
  at scala.util.Try$.apply(Try.scala:209)
  at com.programmaticallyspeaking.ncd.nashorn.NashornDebuggerHost.evaluateOnStackFrame(NashornDebuggerHost.scala:1126)
  at jdk.internal.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
  at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.base/java.lang.reflect.Method.invoke(Method.java:564)
  at com.programmaticallyspeaking.ncd.infra.ExecutorProxy$Handler.$anonfun$invoke$2(ExecutorProxy.scala:29)
  at scala.util.Try$.apply(Try.scala:209)
  at com.programmaticallyspeaking.ncd.infra.ExecutorProxy$Handler.$anonfun$invoke$1(ExecutorProxy.scala:29)
  at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
  at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
  at java.base/java.lang.Thread.run(Thread.java:844)

Maybe it's the actual code string, need to investigate.

provegard commented 7 years ago

Failing test: "should support pausing at next statement when there's no function call involved and the thread isn't sleeping"

Also interesting:

[2017-09-06T21:45:12.033957400Z] [NashornDebuggerHost][INFO]: Will pause at next script statement
[2017-09-06T21:45:12.033957400Z] [NashornDebuggerHost][DEBUG]: Creating one-off breakpoint request(s) at [java.lang.ref.ReferenceQueue:143, java.lang.ref.ReferenceQueue:144, java.lang.ref.ReferenceQueue:146, java.lang.ref.ReferenceQueue:147, java.lang.ref.ReferenceQueue:148, java.lang.ref.ReferenceQueue:149, java.lang.ref.ReferenceQueue:151, java.lang.ref.ReferenceQueue:152, java.lang.ref.ReferenceQueue:153, java.lang.ref.ReferenceQueue:154, java.lang.ref.ReferenceQueue:155, java.lang.ref.ReferenceQueue:156, java.lang.ref.ReferenceQueue:157, java.lang.ref.ReferenceQueue:158, java.lang.ref.ReferenceQueue:159, java.lang.ref.ReferenceQueue:161, jdk.nashorn.internal.runtime.AccessorProperty:644, jdk.nashorn.internal.runtime.AccessorProperty:645, jdk.nashorn.internal.runtime.AccessorProperty:648] and method entry/exit requests for pausing.
provegard commented 7 years ago
[2017-09-06T21:45:12.060957Z] [NashornDebuggerHost][DEBUG]: Pausing at location jdk.nashorn.internal.runtime.AccessorProperty:644 in thread main
[2017-09-06T21:45:12.061457100Z] [NashornDebuggerHost][INFO]: Pausing at eval:///ScriptRecompilation20/eval/1503660218:3: while (!done) {