sourcegraph / sourcegraph-public-snapshot

Code AI platform with Code Search & Cody
https://sourcegraph.com
Other
10.12k stars 1.29k forks source link

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

Open ArtsiomCh opened 4 months ago

ArtsiomCh commented 4 months ago

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.

HuergoMarce commented 3 months ago
### _Hello, let me introduce myself._
My name is Marcelo J. Huergo, ing in UTN arg systems - I would like to be able to contribute or track non-ACTIVE in your directory, any questions you have you can consult my RED HAT ISO credentials to verify that there are no scams. I await a response.****