cursive-ide / cursive

Cursive: The IDE for beautiful Clojure code
579 stars 7 forks source link

Synchronizing Leiningen projects give errors about writing in EDT #2952

Closed Sardtok closed 1 day ago

Sardtok commented 2 weeks ago

Since one of the recent releases (currently running 1.3.5-2024.2 and IntelliJ 2024.2.0.2) I've been getting the following error whenever I update a project.clj file or try to synchronize Leiningen projects:

Write access is allowed inside write-action only (see Application.runWriteAction()); see https://jb.gg/ij-platform-threading for details Current thread: Thread[#683,ApplicationImpl pooled thread 56,4,main] 2108988916 (EventQueue.isDispatchThread()=false) SystemEventQueueThread: Thread[#92,AWT-EventQueue-0,6,main] 123783798

IntelliJ is not providing a whole lot of info for debugging this, though. It might not be Cursive, but it only happens for Leiningen and not Deps projects, I've tried disabling Clojure Extras and Clojure Pretty Symbol to make sure it wasn't related to any of them.

cursive-ide commented 2 weeks ago

Could you send the whole stack trace from the log, please?

Sardtok commented 2 weeks ago

From idea.log:

2024-08-30 10:48:00,147 [74496198] WARN - #cursive.build.BuildSystemUtil - Write access is allowed inside write-action only (see Application.runWriteAction()); see https://jb.gg/ij-platform-threading for details Current thread: Thread[#3619,ApplicationImpl pooled thread 144,4,main] 661557623 (EventQueue.isDispatchThread()=false) SystemEventQueueThread: Thread[#92,AWT-EventQueue-0,6,main] 123783798 com.intellij.openapi.diagnostic.RuntimeExceptionWithAttachments: Write access is allowed inside write-action only (see Application.runWriteAction()); see https://jb.gg/ij-platform-threading for details Current thread: Thread[#3619,ApplicationImpl pooled thread 144,4,main] 661557623 (EventQueue.isDispatchThread()=false) SystemEventQueueThread: Thread[#92,AWT-EventQueue-0,6,main] 123783798 at com.intellij.util.concurrency.ThreadingAssertions.createThreadAccessException(ThreadingAssertions.java:177) at com.intellij.util.concurrency.ThreadingAssertions.throwThreadAccessException(ThreadingAssertions.java:172) at com.intellij.util.concurrency.ThreadingAssertions.assertWriteAccess(ThreadingAssertions.java:167) at com.intellij.openapi.application.impl.ApplicationImpl.assertWriteAccessAllowed(ApplicationImpl.java:1013) at com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry.rename(VirtualFileSystemEntry.java:297) at com.intellij.configurationStore.ModuleStateStorageManager.rename(ModuleStoreImpl.kt:127) at com.intellij.openapi.module.impl.ModuleImpl.rename(ModuleImpl.kt:138) at com.intellij.workspaceModel.ide.impl.legacyBridge.module.ModuleBridgeImpl.rename(ModuleBridgeImpl.kt:77) at com.intellij.workspaceModel.ide.impl.legacyBridge.module.ModifiableModuleModelBridgeImpl.renameModule(ModifiableModuleModelBridgeImpl.kt:267) at cursive.build.sync$ensure_module_name$fn__11412.invoke(sync.clj:36) at cursive.build.sync$ensure_module_name.invokeStatic(sync.clj:34) at cursive.build.sync$ensure_module_name.invoke(sync.clj:30) at cursive.leiningen.sync$sync_modules_BANG_.invokeStatic(sync.clj:98) at cursive.leiningen.sync$sync_modules_BANG_.invoke(sync.clj:87) at cursive.leiningen.sync$sync$fn__17749.invoke(sync.clj:158) at cursive.leiningen.sync$sync.invokeStatic(sync.clj:145) at cursive.leiningen.sync$sync.invoke(sync.clj:135) at clojure.lang.Var.invoke(Var.java:395) at cursive.api.DelayedFn.invoke(DelayedFn.java:41) at cursive.build.BuildSystemProjectsManager.reimportAllProjects$lambda$10$lambda$9(BuildSystemManager.kt:187) at cursive.build.BuildSystemUtil$runTask$1$1.run(BuildSystemUtil.kt:84) at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:477) at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:133) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$6(CoreProgressManager.java:528) at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:249) at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:96) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:221) at com.intellij.platform.diagnostic.telemetry.helpers.TraceKt.use(trace.kt:49) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:220) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:660) at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:735) at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:691) at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:659) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:79) at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:202) at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:96) at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$5(ProgressRunner.java:249) at com.intellij.openapi.progress.impl.ProgressRunner$ProgressRunnable.run(ProgressRunner.java:501) at com.intellij.openapi.progress.impl.ProgressRunner.lambda$launchTask$18(ProgressRunner.java:466) at com.intellij.util.concurrency.ChildContext$runAsCoroutine$1.invoke(propagation.kt:92) at com.intellij.util.concurrency.ChildContext$runAsCoroutine$1.invoke(propagation.kt:92) at com.intellij.util.concurrency.ChildContext.runAsCoroutine(propagation.kt:97) at com.intellij.util.concurrency.ChildContext.runAsCoroutine(propagation.kt:92) at com.intellij.openapi.progress.impl.ProgressRunner.lambda$launchTask$19(ProgressRunner.java:464) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:735) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:732) at java.base/java.security.AccessController.doPrivileged(AccessController.java:400) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:732) at java.base/java.lang.Thread.run(Thread.java:1583)

Leiningen projects seem to synchronize just fine, this looks like it happens at the end when finishing up the sync task. The notification pop-up is quite annoying, but it seems like everything is working.

This is on Linux, by the way.

cursive-ide commented 2 weeks ago

Thanks, I've guarded against that - it looks like it's caused by two modules having the same name.

Sardtok commented 2 weeks ago

IntelliJ project modules? I don't see any modules in the project with the same name as one another. I can try to have a look through the iml files to see if there's something strange in one of them, though.

cursive-ide commented 1 week ago

Yes, in the case of Leiningen the names are taken from the names of the lein projects. But no worries, I've reproduced this and fixed it for the next build.

Sardtok commented 5 days ago

There was definitely something weird. Not sure what had happened, but I found the offending module in a different error that only occurred on startup. Removed the module from the Leiningen Projects, then from the Project modules, re-imported it and it looks like there are no problems on startup or refreshing Leiningen projects.

cursive-ide commented 1 day ago

Fix released in 1.14.0-eap1 on 2024-09-13.