Error in SonarLint for IntelliJ about read access from outside dispatch thread

Environment:

  • Java version=11.0.11
  • Java vendor=JetBrains s.r.o.
  • OS name=Windows 10
  • OS architecture=amd64
  • IDE=PyCharm 2021.2
  • SonarLint version=5.1.0.34721

Details: Current thread: Thread[ApplicationImpl pooled thread 66,4,main] 1207826223
; dispatch thread: false; isDispatchThread(): false
SystemEventQueueThread: Thread[AWT-EventQueue-0,6,main] 878756300

java.lang.Throwable: Read access is allowed from inside read-action (or EDT) only (see com.intellij.openapi.application.Application.runReadAction())
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:200)
	at com.intellij.openapi.application.impl.ApplicationImpl.assertReadAccessAllowed(ApplicationImpl.java:969)
	at com.intellij.openapi.fileEditor.impl.FileDocumentManagerBase.getDocument(FileDocumentManagerBase.java:38)
	at org.sonarlint.intellij.analysis.SonarLintAnalyzer.createClientInputFile(SonarLintAnalyzer.java:161)
	at org.sonarlint.intellij.module.ModuleFileSystem$files$3.processFile(ModuleFileSystem.kt:46)
	at com.intellij.openapi.roots.impl.FileIndexBase.lambda$toContentIteratorEx$0(FileIndexBase.java:77)
	at com.intellij.openapi.roots.impl.FileIndexBase$1.visitFileEx(FileIndexBase.java:60)
	at com.intellij.openapi.vfs.VfsUtilCore.visitChildrenRecursively(VfsUtilCore.java:293)
	at com.intellij.openapi.vfs.VfsUtilCore.visitChildrenRecursively(VfsUtilCore.java:325)
	at com.intellij.openapi.vfs.VfsUtilCore.visitChildrenRecursively(VfsUtilCore.java:325)
	at com.intellij.openapi.roots.impl.FileIndexBase.iterateContentUnderDirectory(FileIndexBase.java:41)
	at com.intellij.openapi.roots.impl.ModuleFileIndexImpl.iterateContentUnderDirectory(ModuleFileIndexImpl.java:20)
	at com.intellij.openapi.roots.impl.ModuleFileIndexImpl.iterateContent(ModuleFileIndexImpl.java:35)
	at com.intellij.openapi.roots.impl.FileIndexBase.iterateContent(FileIndexBase.java:33)
	at com.intellij.openapi.roots.impl.ModuleFileIndexImpl.iterateContent(ModuleFileIndexImpl.java:20)
	at org.sonarlint.intellij.module.ModuleFileSystem.files(ModuleFileSystem.kt:44)
	at org.sonarlint.intellij.module.ModuleFileSystem.files(ModuleFileSystem.kt:36)
	at org.sonarsource.sonarlint.core.container.module.SonarLintModuleFileSystem.files(SonarLintModuleFileSystem.java:39)
	at org.sonar.plugins.python.indexer.SonarLintPythonIndexer.getInputFiles(SonarLintPythonIndexer.java:82)
	at org.sonar.plugins.python.indexer.SonarLintPythonIndexer.buildOnce(SonarLintPythonIndexer.java:59)
	at org.sonar.plugins.python.PythonScanner.<init>(PythonScanner.java:83)
	at org.sonar.plugins.python.PythonSensor.execute(PythonSensor.java:106)
	at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.executeSensor(SensorsExecutor.java:80)
	at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.execute(SensorsExecutor.java:71)
	at org.sonarsource.sonarlint.core.container.analysis.AnalysisContainer.doAfterStart(AnalysisContainer.java:133)
	at org.sonarsource.sonarlint.core.container.ComponentContainer.startComponents(ComponentContainer.java:126)
	at org.sonarsource.sonarlint.core.container.ComponentContainer.execute(ComponentContainer.java:111)
	at org.sonarsource.sonarlint.core.container.standalone.StandaloneGlobalContainer.analyze(StandaloneGlobalContainer.java:162)
	at org.sonarsource.sonarlint.core.StandaloneSonarLintEngineImpl.lambda$analyze$0(StandaloneSonarLintEngineImpl.java:95)

I will add that I have no idea why it brought me here from within the IDE. I was using PyCharm. This error popped up along with a popup and it redirected to this forum. Some reason it wanted this info here despite that I don’t have an issue so… :confused:

Hello Scott,

Thanks for joining the community and raising this issue! I moved your posts to a separate topic as they were unrelated to the original thread.

This issue has been fixed in the latest release. I encourage you to update to the latest version from the Marketplace