Bug 301412 - com.sun.jdi.ObjectCollectedException in Error Log
Summary: com.sun.jdi.ObjectCollectedException in Error Log
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
: 332247 378705 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-02-01 08:18 EST by Tomasz Zarna CLA
Modified: 2023-01-05 10:37 EST (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomasz Zarna CLA 2010-02-01 08:18:41 EST
3.6M5 (I20100129-1300)

I was debugging something this morning and after a while I saw many "Internal error logged from JDI Debug: com.sun.jdi.ObjectCollectedException" in the Error Log. I didn't notice the exact moment they were logged.

The top one looks like this (pretty much the same as in bug 272508, comment 0):
com.sun.jdi.ObjectCollectedException
at org.eclipse.jdi.internal.MirrorImpl.defaultReplyErrorHandler(MirrorImpl.java:241)
at org.eclipse.jdi.internal.ReferenceTypeImpl.getSourceDebugExtension(ReferenceTypeImpl.java:1547)
at org.eclipse.jdi.internal.ReferenceTypeImpl.isSourceDebugExtensionAvailable(ReferenceTypeImpl.java:1610)
at org.eclipse.jdi.internal.ReferenceTypeImpl.getStratum(ReferenceTypeImpl.java:1525)
at org.eclipse.jdi.internal.ReferenceTypeImpl.locationsOfLine(ReferenceTypeImpl.java:1794)
at org.eclipse.jdi.internal.ReferenceTypeImpl.locationsOfLine(ReferenceTypeImpl.java:1463)
at org.eclipse.jdi.internal.ReferenceTypeImpl.locationsOfLine(ReferenceTypeImpl.java:996)
at org.eclipse.jdt.internal.debug.core.breakpoints.JavaLineBreakpoint.determineLocations(JavaLineBreakpoint.java:313)
at org.eclipse.jdt.internal.debug.core.breakpoints.JavaLineBreakpoint.newRequests(JavaLineBreakpoint.java:258)
at org.eclipse.jdt.internal.debug.core.breakpoints.JavaBreakpoint.createRequest(JavaBreakpoint.java:442)
at org.eclipse.jdt.internal.debug.core.breakpoints.JavaBreakpoint.handleClassPrepareEvent(JavaBreakpoint.java:336)
at org.eclipse.jdt.internal.debug.core.breakpoints.JavaBreakpoint.handleEvent(JavaBreakpoint.java:271)
at org.eclipse.jdt.internal.debug.core.EventDispatcher.dispatch(EventDispatcher.java:189)
at org.eclipse.jdt.internal.debug.core.EventDispatcher.access$0(EventDispatcher.java:104)
at org.eclipse.jdt.internal.debug.core.EventDispatcher$1.run(EventDispatcher.java:250)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

where all the others present stack trace like this:

org.eclipse.jdi.TimeoutException: Timeout occurred while waiting for packet 1565.
at org.eclipse.jdi.internal.connect.PacketReceiveManager.getReply(PacketReceiveManager.java:171)
at org.eclipse.jdi.internal.connect.PacketReceiveManager.getReply(PacketReceiveManager.java:180)
at org.eclipse.jdi.internal.MirrorImpl.requestVM(MirrorImpl.java:174)
at org.eclipse.jdi.internal.MirrorImpl.requestVM(MirrorImpl.java:192)
at org.eclipse.jdi.internal.MirrorImpl.requestVM(MirrorImpl.java:207)
at org.eclipse.jdi.internal.ThreadReferenceImpl.isSuspended(ThreadReferenceImpl.java:299)
at org.eclipse.jdt.internal.debug.core.model.JDIThread.initialize(JDIThread.java:339)
at org.eclipse.jdt.internal.debug.core.model.JDIThread.<init>(JDIThread.java:261)
at org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget.newThread(JDIDebugTarget.java:525)
at org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget.createThread(JDIDebugTarget.java:502)
at org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget$ThreadStartHandler.handleEvent(JDIDebugTarget.java:1862)
at org.eclipse.jdt.internal.debug.core.EventDispatcher.dispatch(EventDispatcher.java:155)
at org.eclipse.jdt.internal.debug.core.EventDispatcher.access$0(EventDispatcher.java:104)
at org.eclipse.jdt.internal.debug.core.EventDispatcher$1.run(EventDispatcher.java:250)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Comment 1 Canna Wen CLA 2010-02-01 17:10:14 EST
I have been encountering the com.sun.jdi.ObjectCollectedException error as well, with the exact same stack trace. However, I have only ever seen one in the error log (not dozens).

In my experience, the error happens due to a breakpoint not being installed when you try to start a debug session. There is no check mark on the breakpoint in the breakpoints view, and the breakpoint is not hit. This is an intermittent problem, happening about 5-10% of the time.

If you restart the debug session, the breakpoint still does not get hit (but there are no additional messages in the error log). If you disable and then enable the breakpoint, it will be installed and the thread will suspend at it.
Comment 2 Tomasz Zarna CLA 2010-02-02 05:03:55 EST
I'm sorry as an engineer I should be more precise: 
* In the Error Log I see 47 errors of the second type, all of them were logged at 12:48PM...
* ...where the top one, the one you're referring to, was logged only once at 12:54PM. This probably means that they're not related, I haven't noticed that earlier, sorry. 
* I've have 100+ breakpoints created, most of them are disabled though.
Comment 3 Michael Rennie CLA 2010-02-02 12:27:15 EST
I have started receiving this as well using I20100129-1300. While debugging a target workspace, after a line breakpoint with the following condition is hit a few times the error (com.sun.jdi.ObjectCollectedException) will start appearing:

reference.getReferenceKind() == IReference.REF_CHECKCAST

I get no entries in my log for this though.
Comment 4 Michael Rennie CLA 2010-02-02 13:45:08 EST
After adding in some tracing and exporting JDT debug into my host I captured the stacktraces for my object collected problem:

com.sun.jdi.ObjectCollectedException
at org.eclipse.jdi.internal.MirrorImpl.defaultReplyErrorHandler(MirrorImpl.java:241)
at org.eclipse.jdi.internal.ObjectReferenceImpl.referenceType(ObjectReferenceImpl.java:478)
at org.eclipse.jdi.internal.ObjectReferenceImpl.type(ObjectReferenceImpl.java:494)
at org.eclipse.jdi.internal.ValueImpl.checkValue(ValueImpl.java:180)
at org.eclipse.jdi.internal.ValueImpl.checkValues(ValueImpl.java:160)
at org.eclipse.jdi.internal.ClassTypeImpl.invokeMethod(ClassTypeImpl.java:160)
at org.eclipse.jdt.internal.debug.core.model.JDIThread.invokeMethod(JDIThread.java:849)
at org.eclipse.jdt.internal.debug.core.model.JDIClassType.sendMessage(JDIClassType.java:93)
at org.eclipse.jdt.internal.debug.eval.ast.engine.AbstractRuntimeContext.classForName(AbstractRuntimeContext.java:110)
at org.eclipse.jdt.internal.debug.eval.ast.engine.AbstractRuntimeContext.classForName(AbstractRuntimeContext.java:126)
at org.eclipse.jdt.internal.debug.eval.ast.instructions.Instruction.getType(Instruction.java:204)
at org.eclipse.jdt.internal.debug.eval.ast.instructions.PushStaticFieldVariable.execute(PushStaticFieldVariable.java:42)
at org.eclipse.jdt.internal.debug.eval.ast.engine.Interpreter.execute(Interpreter.java:66)
at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine$1$EvaluationRunnable.run(ASTEvaluationEngine.java:483)
at org.eclipse.jdt.internal.debug.core.model.JDIThread.runEvaluation(JDIThread.java:681)
at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine$EvalRunnable.run(ASTEvaluationEngine.java:520)
at org.eclipse.jdt.internal.debug.core.model.JDIThread$ThreadJob.run(JDIThread.java:2755)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Stepping through the problem I found that during a VM call to look up a class, the StringReferece we create to pass in to the message is being GC'd
Comment 5 Michael Rennie CLA 2010-02-02 14:50:35 EST
(In reply to comment #4)

> Stepping through the problem I found that during a VM call to look up a class,
> the StringReferece we create to pass in to the message is being GC'd

My problem looks closer to bug 33452, where objects are being collected during an evaluation that we need. Created new bug 301584 for my collected issues.
Comment 6 Canna Wen CLA 2010-02-08 14:30:57 EST
Is there anyone looking the com.sun.jdi.ObjectCollectedException error?
Has anyone else seen this bug cause breakpoints to be not installed?
Comment 7 Darin Wright CLA 2010-02-09 14:15:48 EST
(In reply to comment #6)
> Is there anyone looking the com.sun.jdi.ObjectCollectedException error?
> Has anyone else seen this bug cause breakpoints to be not installed?

Does anyone have a simple test case for us? Does this happen on different VMs? (Sun vs. IBM, Java 6 vs. Java 5, etc)?
Comment 8 Tomasz Zarna CLA 2010-02-09 15:22:56 EST
I'm running on Sun's VM version 1.6.0_17.
Comment 9 Canna Wen CLA 2010-02-16 17:40:59 EST
I am using IBM's VM, Java 6
Comment 10 Darin Wright CLA 2010-02-17 12:08:42 EST
This really looks like a VM bug...

The VM is sending a class prepare event for a type to the debug client. The debug client then starts to compute the line number debug attributes for that type. The debug client asks the VM for the source debug extension for the type which results in an "INVALID_OBJECT" return code (meaning that the reference type ID provided by the VM in the event is unknown to the VM).

I have not been able to reproduce the problem, but I would suggest trying newer (if available) or older VM's to see if the problem persists. I have not been able to find a related bug in the Sun bug database.
Comment 11 Darin Wright CLA 2010-04-29 15:08:24 EDT
Removing milestone, since we don't have a reproduceable test case. Is this still an issue, do you have any more details on the problem?
Comment 12 Andrew Niefer CLA 2010-05-14 15:47:11 EDT
I'm hitting this in I20100513-1500 on linux.x86_64.
My vm is a new IBM 1.6.0 SR8 (20100401).  I don't have steps, disabling and re-enabling the breakpoint seems to have fixed the problem.
Comment 13 Michael Rennie CLA 2010-12-10 09:41:19 EST
*** Bug 332247 has been marked as a duplicate of this bug. ***
Comment 14 Michael Rennie CLA 2012-05-11 13:16:35 EDT
*** Bug 378705 has been marked as a duplicate of this bug. ***
Comment 15 Eclipse Genie CLA 2020-07-02 13:57:53 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 16 Eclipse Genie CLA 2023-01-05 10:37:30 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.