ashald / EnvFile

EnvFile 3.x is a plugin for JetBrains IDEs that allows you to set environment variables for your run configurations from one or multiple files.
MIT License
548 stars 129 forks source link

Read access is allowed from inside read-action (or EDT) only #219

Open mariusboepple opened 1 year ago

mariusboepple commented 1 year ago

I'm using the EnvFile plugin for Cucumber tests. But since updating to a new M2 MacBook, I'm getting the following error when starting a test:

Stacktrace

java.lang.Throwable: Read access is allowed from inside read-action (or EDT) only (see com.intellij.openapi.application.Application.runReadAction())
Current thread: Thread[ApplicationImpl pooled thread 11,4,main] 572133338 (EventQueue.isDispatchThread()=false)
SystemEventQueueThread: Thread[AWT-EventQueue-0,6,main] 1175589320
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:202)
    at com.intellij.openapi.application.impl.ApplicationImpl.assertReadAccessAllowed(ApplicationImpl.java:1004)
    at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexDataImpl.ensureIsUpToDate(WorkspaceFileIndexDataImpl.kt:127)
    at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexDataImpl.getFileInfo(WorkspaceFileIndexDataImpl.kt:70)
    at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexImpl.getFileInfo(WorkspaceFileIndexImpl.kt:220)
    at com.intellij.workspaceModel.core.fileIndex.impl.WorkspaceFileIndexImpl.findFileSetWithCustomData(WorkspaceFileIndexImpl.kt:205)
    at com.intellij.openapi.roots.impl.ProjectFileIndexImpl.getModuleForFile(ProjectFileIndexImpl.java:133)
    at com.intellij.openapi.roots.impl.ProjectFileIndexImpl.getModuleForFile(ProjectFileIndexImpl.java:125)
    at org.jetbrains.plugins.gradle.execution.build.GradleBaseApplicationEnvironmentProvider.createExecutionEnvironment(GradleBaseApplicationEnvironmentProvider.kt:73)
    at net.ashald.envfile.products.idea.GradleEnvFileProvider.lambda$createExecutionEnvironment$0(GradleEnvFileProvider.java:32)
    at java.base/java.util.Optional.map(Optional.java:260)
    at net.ashald.envfile.products.idea.GradleEnvFileProvider.createExecutionEnvironment(GradleEnvFileProvider.java:32)
    at org.jetbrains.plugins.gradle.execution.build.GradleProjectTaskRunner.createExecutionEnvironment(GradleProjectTaskRunner.java:308)
    at com.intellij.task.impl.ExecutionEnvironmentProviderImpl.createExecutionEnvironment$lambda$0(ExecutionEnvironmentProviderImpl.kt:33)
    at com.intellij.openapi.extensions.impl.ExtensionProcessingHelper.computeSafeIfAny(ExtensionProcessingHelper.kt:57)
    at com.intellij.openapi.extensions.ExtensionPointName.computeSafeIfAny(ExtensionPointName.kt:57)
    at com.intellij.task.impl.ExecutionEnvironmentProviderImpl.createExecutionEnvironment(ExecutionEnvironmentProviderImpl.kt:30)
    at com.intellij.execution.runners.ExecutionEnvironmentBuilder.build(ExecutionEnvironmentBuilder.kt:150)
    at com.intellij.execution.runners.ExecutionEnvironmentBuilder.build$default(ExecutionEnvironmentBuilder.kt:146)
    at com.intellij.execution.impl.ExecutionManagerImpl.compileAndRun$lambda$5(ExecutionManagerImpl.kt:401)
    at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:252)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
    at java.base/java.lang.Thread.run(Thread.java:833)
ls -la
-r--r--r--@  1 username  staff  1028 May 31  2022 test.env

IntelliJ

IntelliJ IDEA 2023.1 (Ultimate Edition)
Build #IU-231.8109.175, built on March 28, 2023

Runtime version: 17.0.6+10-b829.5 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 13.3.1
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 12
Metal Rendering is ON
Registry:
    debugger.new.tool.window.layout=true
    ide.experimental.ui=true

Non-Bundled Plugins:
    IdeaVIM (2.2.0)
    net.ashald.envfile (3.4.1)
    net.lagerwey.cucumber-kotlin (2023.1.0)

Kotlin: 231-1.8.20-IJ8109.175
mariusboepple commented 1 year ago

Updated IntelliJ but the problem is still there

IntelliJ IDEA 2023.1.2 (Ultimate Edition)
Build #IU-231.9011.34, built on May 16, 2023

Runtime version: 17.0.6+10-b829.9 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 13.4
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 12
Metal Rendering is ON
Registry:
    debugger.new.tool.window.layout=true
    ide.experimental.ui=true

Non-Bundled Plugins:
    IdeaVIM (2.2.0)
    net.ashald.envfile (3.4.1)
    net.lagerwey.cucumber-kotlin (2023.1.0)

Kotlin: 231-1.8.21-IJ9011.34
mariusboepple commented 1 year ago

Maybe related to #217

mariusboepple commented 1 year ago

Seems like it's not an IntelliJ bug and other plugins have it as well:

https://youtrack.jetbrains.com/issue/IDEA-286014