cursive icon indicating copy to clipboard operation
cursive copied to clipboard

Running tests sometimes freezes intellij

Open mikekap opened this issue 3 years ago • 2 comments

I'm not sure what about the code I'm working on made cursive unhappy - most tests work fine. Sometimes when running a specific test, IntelliJ will enter a busy loop and refuse to respond to any input.

Running jstack on idea gives only one cursive thread actually doing work. It seems like it's reading all the available files in the project - the repo has XX million lines of just clojure without including third-party deps, so that's potentially a bad idea.

"ApplicationImpl pooled thread 12" #54 prio=4 os_prio=31 cpu=216954.18ms elapsed=607.18s tid=0x00007fe2259cb800 nid=0x2a303 runnable  [0x000070000f636000]
   java.lang.Thread.State: RUNNABLE
	at com.intellij.psi.impl.source.tree.TreeElement.getCachedFile(TreeElement.java:40)
	at com.intellij.psi.impl.source.tree.TreeElement.setTreeParent(TreeElement.java:180)
	at com.intellij.psi.impl.source.tree.TreeElement.rawInsertAfterMeWithoutNotifications(TreeElement.java:284)
	at com.intellij.psi.impl.source.tree.CompositeElement.rawAddChildrenWithoutNotifications(CompositeElement.java:774)
	at com.intellij.lang.impl.PsiBuilderImpl.insertLeaves(PsiBuilderImpl.java:1259)
	at com.intellij.lang.impl.PsiBuilderImpl.bind(PsiBuilderImpl.java:1207)
	at com.intellij.lang.impl.PsiBuilderImpl.buildTree(PsiBuilderImpl.java:906)
	at com.intellij.lang.impl.PsiBuilderImpl.getTreeBuilt(PsiBuilderImpl.java:892)
	at org.intellij.plugins.markdown.lang.MarkdownLazyElementType.doParseContents(MarkdownLazyElementType.java:51)
	at com.intellij.psi.tree.ILazyParseableElementType.parseContents(ILazyParseableElementType.java:50)
	at com.intellij.psi.impl.source.tree.LazyParseableElement.lambda$ensureParsed$2(LazyParseableElement.java:175)
	at com.intellij.psi.impl.source.tree.LazyParseableElement$$Lambda$1500/0x000000080184bc40.run(Unknown Source)
	at com.intellij.psi.impl.DebugUtil.performPsiModification(DebugUtil.java:481)
	at com.intellij.psi.impl.source.tree.LazyParseableElement.ensureParsed(LazyParseableElement.java:174)
	at com.intellij.psi.impl.source.tree.LazyParseableElement.getFirstChildNode(LazyParseableElement.java:226)
	at com.intellij.psi.impl.source.tree.LazyParseableElement.getFirstChildNode(LazyParseableElement.java:24)
	at com.intellij.psi.impl.source.tree.SharedImplUtil.getFirstChild(SharedImplUtil.java:37)
	at com.intellij.extapi.psi.ASTDelegatePsiElement.getFirstChild(ASTDelegatePsiElement.java:99)
	at cursive.iterate$tree$reify__27035.reduce(iterate.clj:15)
	at clojure.core$transduce.invokeStatic(core.clj:6908)
	at clojure.core$into.invokeStatic(core.clj:6924)
	at clojure.core$into.invoke(core.clj:6912)
	at cursive.testing.actions$find_assertion_form$reify__10559.compute(actions.clj:219)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:920)
	at cursive.testing.actions$find_assertion_form.invokeStatic(actions.clj:211)
	at cursive.testing.actions$find_assertion_form.invoke(actions.clj:209)
	at cursive.testing.actions$find_element_for_item$fn__10617.invoke(actions.clj:330)
	at clojure.core$some.invokeStatic(core.clj:2705)
	at clojure.core$some.invoke(core.clj:2696)
	at cursive.testing.actions$find_element_for_item.invokeStatic(actions.clj:329)
	at cursive.testing.actions$find_element_for_item.invoke(actions.clj:323)
	at cursive.testing.actions$fn__10659.invokeStatic(actions.clj:416)
	at cursive.testing.actions$fn__10659.invoke(actions.clj:415)
	at clojure.lang.MultiFn.invoke(MultiFn.java:229)
	at cursive.testing.actions$test_handler$process__10700.invoke(actions.clj:514)
	at cursive.testing.actions$test_handler$reify__10703.out(actions.clj:525)
	at cursive.repl.nrepl$handler.invokeStatic(nrepl.clj:78)
	at cursive.repl.nrepl$handler.invoke(nrepl.clj:61)
	at cursive.repl.nrepl$start$reify__5270$fn__5278.invoke(nrepl.clj:141)
	at cursive.repl.nrepl$start$reify__5270.run(nrepl.clj:140)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:295)
	at java.util.concurrent.Executors$RunnableAdapter.call([email protected]/Executors.java:515)
	at java.util.concurrent.FutureTask.run([email protected]/FutureTask.java:264)
	at java.util.concurrent.ThreadPoolExecutor.runWorker([email protected]/ThreadPoolExecutor.java:1128)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run([email protected]/ThreadPoolExecutor.java:628)
	at java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run([email protected]/Executors.java:668)
	at java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run([email protected]/Executors.java:665)
	at java.security.AccessController.doPrivileged([email protected]/Native Method)
	at java.util.concurrent.Executors$PrivilegedThreadFactory$1.run([email protected]/Executors.java:665)
	at java.lang.Thread.run([email protected]/Thread.java:829)

I'm not too familiar with Intellij, but ApplicationImpl.runReadAction seems to be locking a mutex that prevents the UI thread from doing anything.

mikekap avatar Jul 08 '22 06:07 mikekap

This seems to be an issue with 1.12.4 specifically - rolling back to 1.12.3 fixes it for me.

mikekap avatar Jul 12 '22 20:07 mikekap

I'm not sure what about the code I'm working on made cursive unhappy - most tests work fine. Sometimes when running a specific test, IntelliJ will enter a busy loop and refuse to respond to any input.

I'm having this issue as well :( I'm on:

IntelliJ IDEA 2022.2.2 (Ultimate Edition)
Build #IU-222.4167.29, built on September 13, 2022
Runtime version: 17.0.4+7-b469.53 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.19.9-arch1-1
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 8
Registry:
    debugger.new.tool.window.layout=true
    ide.experimental.ui=true

Non-Bundled Plugins:
    org.rust.lang (0.4.178.4873-222)
    org.intellij.plugins.hcl (222.4167.21)
    djblue.portal (0.30.0)
    com.intellij.nativeDebug (222.4167.21)
    Org4Idea (0.4.1)
    Pythonid (222.4167.37)
    com.cursiveclojure.cursive (1.12.5-eap1-2022.2)
    com.github.brcosta.cljstuffplugin (0.7.4)

Kotlin: 222-1.7.10-release-334-IJ4167.29
Current Desktop: sway

kolstae avatar Sep 23 '22 23:09 kolstae