Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

JetBrains: RuntimeExceptionWithAttachments: Read access is allowed from inside read-action only  #64103

@ArtsiomCh

Description

@ArtsiomCh

Hi. I'm Codiumate plugin developer and we see in our user's error reports next exception happened presumably from your plugin:

      "stack": "com.intellij.openapi.diagnostic.RuntimeExceptionWithAttachments: Read access is allowed from inside read-action only (see Application.runReadAction()); see https://jb.gg/ij-platform-threading for",
      "stackExtra": {
        "0": "details",
        "1": "Current thread: Thread[Thread-66889,5,main] 1795810375 (EventQueue.isDispatchThread()=false)",
        "2": "SystemEventQueueThread: Thread[AWT-EventQueue-0,6,main] 388184618",
        "3": "at com.intellij.util.concurrency.ThreadingAssertions.createThreadAccessException(ThreadingAssertions.java:180)",
        "4": "at com.intellij.util.concurrency.ThreadingAssertions.softAssertReadAccess(ThreadingAssertions.java:131)",
        "5": "at com.intellij.openapi.application.impl.ApplicationImpl.assertReadAccessAllowed(ApplicationImpl.java:908)",
        "6": "at com.intellij.openapi.editor.impl.CaretImpl.getSelectionStart(CaretImpl.java:916)",
        "7": "at com.intellij.openapi.editor.impl.CaretImpl.getSelectedText(CaretImpl.java:1319)",
        "8": "at com.intellij.openapi.editor.SelectionModel.getSelectedText(SelectionModel.java:93)",
        "9": "at com.intellij.openapi.editor.SelectionModel.getSelectedText(SelectionModel.java:71)",
        "10": "at com.sourcegraph.cody.chat.CodeEditorFactory.lambda$createCodeEditor$1(CodeEditorFactory.java:161)",
        "11": "at jdk.internal.reflect.GeneratedMethodAccessor350.invoke(Unknown Source)",
        "12": "at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)",
        "13": "at java.base/java.lang.reflect.Method.invoke(Method.java:568)",
        "14": "at com.intellij.util.EventDispatcher.dispatchVoidMethod(EventDispatcher.java:119)",
        "15": "at com.intellij.util.EventDispatcher.lambda$createMulticaster$1(EventDispatcher.java:84)",
        "16": "at jdk.proxy2/jdk.proxy2.$Proxy280.contentChanged(Unknown Source)",
        "17": "at com.intellij.ide.CopyPasteManagerWithHistory.fireContentChanged(CopyPasteManagerWithHistory.java:255)",
        "18": "at com.intellij.ide.CopyPasteManagerWithHistory.setContents(CopyPasteManagerWithHistory.java:55)",
        "19": "at com.intellij.ide.CopyPasteManagerEx.setContents(CopyPasteManagerEx.java:51)",

We're calling CopyPasteManager.setContents method to copy some text into clipboard.
And seems like under the hood it call some of your listener/handler (through CopyPasteManagerWithHistory.fireContentChanged) that perform some actions over selection in the editor outside of ReadAccess.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions