Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CodeWhispererFileCrawler.isTestFile causing exception popup (Read access is allowed from inside read-action only) #4888

Closed
deki opened this issue Sep 17, 2024 · 2 comments
Labels
bug We can reproduce the issue and confirmed it is a bug. codewhisperer needs-review

Comments

@deki
Copy link

deki commented Sep 17, 2024

Describe the bug
After upgrading Amazon Q plugin in Jetbrains IntelliJ IDEA to 3.28-242 I saw an exception popup with

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 details
Current thread: Thread[#2259,DefaultDispatcher-worker-2,4,main] 346698022 (EventQueue.isDispatchThread()=false)
SystemEventQueueThread: Thread[#54,AWT-EventQueue-0,6,main] 1108334680
	at com.intellij.util.concurrency.ThreadingAssertions.createThreadAccessException(ThreadingAssertions.java:177)
	at com.intellij.util.concurrency.ThreadingAssertions.softAssertReadAccess(ThreadingAssertions.java:129)
	at com.intellij.openapi.application.impl.ApplicationImpl.assertReadAccessAllowed(ApplicationImpl.java:915)
	at com.intellij.psi.impl.source.PsiFileImpl.assertReadAccessAllowed(PsiFileImpl.java:185)
	at com.intellij.psi.impl.source.PsiFileImpl.getStubTreeOrFileElement(PsiFileImpl.java:694)
	at com.intellij.psi.impl.source.PsiFileImpl.withGreenStubOrAst(PsiFileImpl.java:648)
	at com.intellij.lang.javascript.psi.impl.JSFileBaseImpl.getCachedData(JSFileBaseImpl.java:49)
	at com.intellij.lang.javascript.psi.impl.JSFileBaseImpl.getTestFileType(JSFileBaseImpl.java:108)
	at com.intellij.lang.javascript.psi.impl.JSFileBaseImpl.isTestFile(JSFileBaseImpl.java:103)
	at com.intellij.javascript.testFramework.JsTestFileIndexingHandler.isTestFile(JsTestFileIndexingHandler.java:92)
	at com.intellij.javascript.testing.JsTestSourcesFilter.isTestSource(JsTestSourcesFilter.java:12)
	at com.intellij.openapi.roots.TestSourcesFilter.isTestSources(TestSourcesFilter.java:32)
	at software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhispererFileCrawler.isTestFile(CodeWhispererFileCrawler.kt:67)
	at software.aws.toolkits.jetbrains.services.codewhisperer.util.DefaultCodeWhispererFileContextProvider.isTestFile(CodeWhispererFileContextProvider.kt:209)
	at software.aws.toolkits.jetbrains.services.codewhisperer.util.DefaultCodeWhispererFileContextProvider.extractSupplementalFileContext(CodeWhispererFileContextProvider.kt:114)
	at software.aws.toolkits.jetbrains.services.codewhisperer.service.CodeWhispererService$getRequestContext$supplementalContext$1.invokeSuspend(CodeWhispererService.kt:623)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:608)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:873)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:763)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:750)

multiple times.

To reproduce
Navigating through files inside a Java project

Expected behavior
No exception popup

Your Environment
IntelliJ IDEA 2024.2.1 (Ultimate Edition)
Build #IU-242.21829.142, built on August 28, 2024
Licensed to Amazon Corporate, LLC

Runtime version: 21.0.3+13-b509.11 aarch64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.lwawt.macosx.LWCToolkit
macOS 14.6.1
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 3072M
Cores: 8
Metal Rendering is ON
Registry:
ide.experimental.ui=true
i18n.locale=
Non-Bundled Plugins:
aws.toolkit.core (3.28-242)
com.jetbrains.space (242.21829.142)
com.intellij.ml.llm (242.21829.196)
org.jetbrains.plugins.gitlab (242.21829.162)
org.jetbrains.plugins.github (242.21829.162)
amazon.q (3.28-242)
aws.toolkit (3.28-242)
Kotlin: 242.21829.142-IJ

@deki deki added the bug We can reproduce the issue and confirmed it is a bug. label Sep 17, 2024
@rli
Copy link
Contributor

rli commented Sep 17, 2024

probably same as #4848

@rli
Copy link
Contributor

rli commented Sep 20, 2024

Fixed in 3.29

@rli rli closed this as completed Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug We can reproduce the issue and confirmed it is a bug. codewhisperer needs-review
Projects
None yet
Development

No branches or pull requests

3 participants