Skip to content

Slow Operations -- io.flutter.pub.PubRoot.forDirectory(PubRoot.java:141) #7792

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

Open
jwren opened this issue Nov 18, 2024 · 6 comments · Fixed by #7885
Open

Slow Operations -- io.flutter.pub.PubRoot.forDirectory(PubRoot.java:141) #7792

jwren opened this issue Nov 18, 2024 · 6 comments · Fixed by #7885
Assignees
Labels
performance General performance issues (not perf tool)
Milestone

Comments

@jwren
Copy link
Member

jwren commented Nov 18, 2024

java.lang.Throwable: Slow operations are prohibited on EDT. See SlowOperations.assertSlowOperationsAreAllowed javadoc.
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376)
at com.intellij.util.SlowOperations.assertSlowOperationsAreAllowed(SlowOperations.java:106)
at com.intellij.openapi.vfs.newvfs.persistent.FSRecordsImpl.update(FSRecordsImpl.java:727)
at com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl.findChildInfo(PersistentFSImpl.java:672)
at com.intellij.openapi.vfs.newvfs.impl.VirtualDirectoryImpl.findInPersistence(VirtualDirectoryImpl.java:159)
at com.intellij.openapi.vfs.newvfs.impl.VirtualDirectoryImpl.doFindChild(VirtualDirectoryImpl.java:141)
at com.intellij.openapi.vfs.newvfs.impl.VirtualDirectoryImpl.findChild(VirtualDirectoryImpl.java:87)
at com.intellij.openapi.vfs.newvfs.impl.VirtualDirectoryImpl.findChild(VirtualDirectoryImpl.java:541)
at com.intellij.openapi.vfs.newvfs.impl.VirtualDirectoryImpl.findChild(VirtualDirectoryImpl.java:53)
at io.flutter.pub.PubRoot.forDirectory(PubRoot.java:141)
at io.flutter.sdk.FlutterPluginsLibraryManager.getFlutterPluginPaths(FlutterPluginsLibraryManager.java:140)
at io.flutter.sdk.FlutterPluginsLibraryManager.updateFlutterPluginsImpl(FlutterPluginsLibraryManager.java:118)
at io.flutter.sdk.FlutterPluginsLibraryManager.updateFlutterPlugins(FlutterPluginsLibraryManager.java:110)
at com.intellij.openapi.project.DumbServiceImpl.smartInvokeLater$lambda$16(DumbServiceImpl.kt:572)
at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:27)
at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:229)
at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:22)
at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:191)
at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runIntendedWriteActionOnCurrentThread$lambda$1(AnyThreadWriteThreadingSupport.kt:184)
at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runWriteIntentReadAction(AnyThreadWriteThreadingSupport.kt:84)
at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runIntendedWriteActionOnCurrentThread(AnyThreadWriteThreadingSupport.kt:183)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:836)
at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:425)
at com.intellij.openapi.application.impl.AnyThreadWriteThreadingSupport.runWithImplicitRead(AnyThreadWriteThreadingSupport.kt:122)
at com.intellij.openapi.application.impl.ApplicationImpl.runWithImplicitRead(ApplicationImpl.java:1162)

@jwren jwren added the performance General performance issues (not perf tool) label Nov 18, 2024
@jwren jwren added this to the M83 milestone Nov 18, 2024
@jwren jwren self-assigned this Nov 18, 2024
@jwren
Copy link
Member Author

jwren commented Nov 18, 2024

Flutter plugin version 82.0.3, IntelliJ IDEA 2024.2 (Ultimate Edition)

@jwren jwren modified the milestones: M83, M84 Nov 20, 2024
@jwren
Copy link
Member Author

jwren commented Nov 20, 2024

I believe that wrapping this runnable in a nonBlocking ReadAction will resolve this Throwable. https://github.com/JetBrains/intellij-community/blob/idea/243.21565.193/platform/core-api/src/com/intellij/openapi/application/ReadAction.java#L94

@jwren
Copy link
Member Author

jwren commented Apr 9, 2025

The previous fix caused #7968

@jwren jwren added this to the M86 milestone Apr 9, 2025
@pq
Copy link
Contributor

pq commented Apr 15, 2025

@alexander-doroshko: I'm curious if you have any thoughts on the "correct way" to address these exceptions. Is ReadAction.nonBlocking not the right approach? Or are we just holding the API wrong?

@alexander-doroshko
Copy link
Contributor

Yes, in Java it's ReadAction.nonBlocking. There are 4 examples in the Dart plugin.

The second option is switching to Kotlin coroutines and using suspend functions readAction and readAndWriteAction

@pq
Copy link
Contributor

pq commented Apr 17, 2025

Can you see anything wrong w/ what Jaime did in #7885?

That seems to have correlated w/ #7968

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance General performance issues (not perf tool)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants