microsoft / microsoft/java-debug

Breakpoint condition fails with ObjectCollectedException

Open
#568 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ai-triaged
Dominant language
Java
Stars
409
Forks
204
Avg merge
1d 13h
Merged PRs (30d)
4

Description

In a function with 2nd parameter being a String name a conditional breakpoint on the first statement with name.contains("xyz") results in

Breakpoint condition 'name.contains("xyz")' error: com.sun.jdi.ObjectCollectedException occurred invoking method.

The expression does work on the same line in Debug Console.
A BP with !name.isEmpty() does work.
.startsWith("xyz") also throws.

The Java LSP logs contain:

com.microsoft.java.debug.core.adapter.handler.SetBreakpointsRequestHandler handleEvaluationResult
SEVERE: [ConditionalBreakpoint]: com.sun.jdi.ObjectCollectedException occurred invoking method.
org.eclipse.debug.core.DebugException: com.sun.jdi.ObjectCollectedException occurred invoking method.
	at org.eclipse.jdt.internal.debug.core.model.JDIDebugElement.throwDebugException(JDIDebugElement.java:263)
	at org.eclipse.jdt.internal.debug.core.model.JDIDebugElement.requestFailed(JDIDebugElement.java:202)
	at org.eclipse.jdt.internal.debug.core.model.JDIThread.invokeFailed(JDIThread.java:1257)
	at org.eclipse.jdt.internal.debug.core.model.JDIThread.invokeFailed(JDIThread.java:1226)
	at org.eclipse.jdt.internal.debug.core.model.JDIThread.invokeMethod(JDIThread.java:1026)
	at org.eclipse.jdt.internal.debug.core.model.JDIObjectValue.sendMessage(JDIObjectValue.java:162)
	at org.eclipse.jdt.internal.debug.eval.ast.instructions.SendMessage.execute(SendMessage.java:60)
	at org.eclipse.jdt.internal.debug.eval.ast.engine.Interpreter.execute(Interpreter.java:69)
	at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine$EvalRunnable$1EvaluationRunnable.run(ASTEvaluationEngine.java:843)
	at org.eclipse.jdt.internal.debug.core.model.JDIThread.runEvaluation(JDIThread.java:832)
	at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine$EvalRunnable.run(ASTEvaluationEngine.java:896)
	at org.eclipse.jdt.internal.debug.core.model.JDIThread$ThreadJob.run(JDIThread.java:3490)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: com.sun.jdi.ObjectCollectedException
	at org.eclipse.jdi.internal.MirrorImpl.defaultReplyErrorHandler(MirrorImpl.java:294)
	at org.eclipse.jdi.internal.ObjectReferenceImpl.referenceType(ObjectReferenceImpl.java:530)
	at org.eclipse.jdi.internal.ObjectReferenceImpl.type(ObjectReferenceImpl.java:547)
	at org.eclipse.jdi.internal.ValueImpl.checkValue(ValueImpl.java:196)
	at org.eclipse.jdi.internal.ValueImpl.checkValues(ValueImpl.java:172)
	at org.eclipse.jdi.internal.ObjectReferenceImpl.invokeMethod(ObjectReferenceImpl.java:414)
	at org.eclipse.jdt.internal.debug.core.model.JDIThread.invokeMethod(JDIThread.java:1009)
	... 8 more

com.microsoft.java.debug.core.UsageDataSession recordResponse
WARNING: abnormal response

eclipse_adoptium-21-amd64-windows.2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the conditional breakpoint in ConvertModels.java around the linked function and compare it with the Debug Console behavior. Start with SetBreakpointsRequestHandler and the JDI evaluation stack shown in the logs, including JDIThread.invokeMethod. Done means String conditions such as contains and startsWith no longer report ObjectCollectedException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.