Uploaded image for project: 'SonarLint For IntelliJ'
  1. SonarLint For IntelliJ
  2. SLI-581

Error accessing document content outside of read action

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.2
    • Component/s: None
    • Labels:
      None

      Description

      An error can happen when accessing document content while browsing the ModuleFileSystem:

       

      java.lang.Throwable: Read access is allowed from event dispatch thread or inside read-action only (see com.intellij.openapi.application.Application.runReadAction())
      	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:179)
      	at com.intellij.openapi.application.impl.ApplicationImpl.assertReadAccessAllowed(ApplicationImpl.java:992)
      	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:78)
      	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.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)
      

       

      A way to reproduce the problem is the following:

      • open a project without any file opened
      • open an unrelated file, like a json file and modify it wihout saving
      • open a .py file

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              julien.henry Julien Henry
              Reporter:
              damien.urruty Damien Urruty
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: