Skip to content

Coroutine debugger does not work with 1.5.0-RC #2690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
elizarov opened this issue May 9, 2021 · 2 comments
Closed

Coroutine debugger does not work with 1.5.0-RC #2690

elizarov opened this issue May 9, 2021 · 2 comments
Assignees
Labels

Comments

@elizarov
Copy link
Contributor

elizarov commented May 9, 2021

See https://youtrack.jetbrains.com/issue/KTIJ-11620
The error is:

Exception is thrown by calling dumpCoroutines.

java.lang.IllegalStateException: Unable to find loaded class _COROUTINE._CREATION
	at org.jetbrains.kotlin.idea.debugger.coroutine.proxy.LocationCache.createLocation(LocationCache.kt:17)
...
@elizarov elizarov added the bug label May 9, 2021
@dkhalanskyjb dkhalanskyjb self-assigned this May 11, 2021
@dkhalanskyjb
Copy link
Collaborator

dkhalanskyjb commented May 11, 2021

_COROUTINE._CREATION was introduced in 1.5.0-RC: #2461, and it is now transitively used during the initialization of DebugProbesImpl. This is probably the root cause of this issue, as, looking at https://github.com/JetBrains/kotlin/blob/master/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/proxy/mirror/coroutinesDebugMirror.kt, my surface understanding is that the plugin proxies every class that could be needed for DebugProbesImpl to function.

Looking at the jar file for 1.5.0-RC, it does contain the _COROUTINE._CREATION class, so there should be no problems with loading it; it's unclear though why ArtificialStackFrames, a class that is also needed now for DebugProbesImpl to function, does not provoke the same reaction.

Also, while I am somewhat able to reproduce this, I get a different stack trace:

java.lang.IllegalArgumentException: Argument for @NotNull parameter 'refType' of com/intellij/debugger/engine/DebuggerUtils.findMethod must not be null
	at com.intellij.debugger.engine.DebuggerUtils.$$$reportNull$$$0(DebuggerUtils.java)
	at com.intellij.debugger.engine.DebuggerUtils.findMethod(DebuggerUtils.java)
	at com.intellij.debugger.jdi.GeneratedLocation.<init>(GeneratedLocation.java:21)
	at org.jetbrains.kotlin.idea.debugger.coroutine.proxy.LocationCache.createLocation(LocationCache.kt:36)
	at org.jetbrains.kotlin.idea.debugger.coroutine.proxy.LocationCache.createLocation(LocationCache.kt:17)
	at org.jetbrains.kotlin.idea.debugger.coroutine.proxy.CoroutineLibraryAgent2Proxy.findStackFrames(CoroutineLibraryAgent2Proxy.kt:86)
	at org.jetbrains.kotlin.idea.debugger.coroutine.proxy.CoroutineLibraryAgent2Proxy.mapToCoroutineInfoData(CoroutineLibraryAgent2Proxy.kt:37)
	at org.jetbrains.kotlin.idea.debugger.coroutine.proxy.CoroutineLibraryAgent2Proxy.dumpCoroutinesInfo(CoroutineLibraryAgent2Proxy.kt:30)
	at org.jetbrains.kotlin.idea.debugger.coroutine.proxy.CoroutineDebugProbesProxy.dumpCoroutines(CoroutineDebugProbesProxy.kt:29)
	at org.jetbrains.kotlin.idea.debugger.coroutine.view.XCoroutineView$CoroutineGroupContainer$computeChildren$1.invoke(XCoroutineView.kt:154)
	at org.jetbrains.kotlin.idea.debugger.coroutine.view.XCoroutineView$CoroutineGroupContainer$computeChildren$1.invoke(XCoroutineView.kt:147)
	at org.jetbrains.kotlin.idea.debugger.coroutine.proxy.ManagerThreadExecutor$ManagerThreadExecutorInstance$makeCommand$1.contextAction(ManagerThreadExecutor.kt:45)
	at com.intellij.debugger.engine.events.SuspendContextCommandImpl.action(SuspendContextCommandImpl.java:57)
	at com.intellij.debugger.engine.events.DebuggerCommandImpl.run(DebuggerCommandImpl.java:43)
	at com.intellij.debugger.engine.DebuggerManagerThreadImpl.processEvent(DebuggerManagerThreadImpl.java:154)
	at com.intellij.debugger.engine.DebuggerManagerThreadImpl.processEvent(DebuggerManagerThreadImpl.java:29)
	at com.intellij.debugger.impl.InvokeThread.lambda$run$0(InvokeThread.java:138)
	at com.intellij.openapi.project.DumbService.runWithAlternativeResolveEnabled(DumbService.java:367)
	at com.intellij.debugger.impl.InvokeThread.run(InvokeThread.java:125)
	at com.intellij.debugger.impl.InvokeThread$WorkerThreadRequest.lambda$run$0(InvokeThread.java:49)
	at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:208)
	at com.intellij.debugger.impl.InvokeThread$WorkerThreadRequest.run(InvokeThread.java:48)
	at com.intellij.util.RunnableCallable.call(RunnableCallable.java:20)
	at com.intellij.util.RunnableCallable.call(RunnableCallable.java:11)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:270)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
	at java.base/java.lang.Thread.run(Thread.java:834)

dkhalanskyjb added a commit that referenced this issue May 11, 2021
#2461 introduced
a problem where the coroutine debugger in the IDE would crash:
#2690

According to @nikita-nazarov, the coroutine debugger crashes at a
point where a stack trace is already available and the IDE plugin
attempts to look up every class listed in the stack trace.

The new classes listed in the artificial stack frames were never
loaded, as only their names were accessed. Now, we force these
classes to be loaded, and it seems like the crash disappears.
@qwwdfsad
Copy link
Collaborator

Fixed in 1.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants