felangel / bloc

A predictable state management library that helps implement the BLoC design pattern
https://bloclibrary.dev
MIT License
11.53k stars 3.37k forks source link

Unable to upgrade to 4.0.0 Bloc plugin on Intellij #4166

Closed DanMossa closed 1 month ago

DanMossa commented 1 month ago

Description Same issue as https://github.com/felangel/bloc/issues/3938#issue-1857960276

Steps To Reproduce I'm hovering over any code, and trying to trigger an auto complete.

Screenshots

Exceptions occurred on invoking the intention 'Wrap with BlocBuilder' (class com.bloc.intellij_generator_plugin.intention_action.BlocWrapWithBlocBuilderIntentionAction) on a copy of the file.

java.lang.IllegalStateException: Must not start write action from within read action in the other thread - deadlock is coming
    at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.run(WriteCommandAction.java:113)
    at com.intellij.openapi.command.WriteCommandAction.runWriteCommandAction(WriteCommandAction.java:338)
    at com.intellij.openapi.command.WriteCommandAction.runWriteCommandAction(WriteCommandAction.java:326)
    at com.bloc.intellij_generator_plugin.intention_action.BlocWrapWithIntentionAction.invoke(BlocWrapWithIntentionAction.kt:60)
    at com.intellij.codeInsight.intention.PsiElementBaseIntentionAction.invoke(PsiElementBaseIntentionAction.java:27)
    at com.intellij.codeInsight.intention.impl.config.IntentionActionWrapper.invoke(IntentionActionWrapper.java:80)
    at com.intellij.codeInsight.intention.impl.IntentionActionWithTextCaching$MyIntentionAction.invoke(IntentionActionWithTextCaching.java:251)
    at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewComputable.generateFallbackDiff$lambda$4$lambda$3(IntentionPreviewComputable.kt:198)
    at com.intellij.psi.impl.source.PostprocessReformattingAspectImpl.lambda$postponeFormattingInside$2(PostprocessReformattingAspectImpl.java:139)
    at com.intellij.psi.impl.source.PostprocessReformattingAspectImpl.postponeFormattingInside(PostprocessReformattingAspectImpl.java:148)
    at com.intellij.psi.impl.source.PostprocessReformattingAspectImpl.postponeFormattingInside(PostprocessReformattingAspectImpl.java:138)
    at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewComputable.generateFallbackDiff$lambda$4(IntentionPreviewComputable.kt:198)
    at com.intellij.codeInsight.intention.preview.IntentionPreviewUtils.previewSession(IntentionPreviewUtils.java:123)
    at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewComputable.generateFallbackDiff(IntentionPreviewComputable.kt:196)
    at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewComputable.access$generateFallbackDiff(IntentionPreviewComputable.kt:38)
    at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewComputable$invokePreview$2.invoke(IntentionPreviewComputable.kt:137)
    at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewComputable$invokePreview$2.invoke(IntentionPreviewComputable.kt:137)
    at com.intellij.model.SideEffectGuard$Companion.computeWithAllowedSideEffectsBlocking(SideEffectGuard.kt:42)
    at com.intellij.model.SideEffectGuard$Companion.computeWithoutSideEffects(SideEffectGuard.kt:27)
    at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewComputable.invokePreview(IntentionPreviewComputable.kt:137)
    at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewComputable.generatePreview(IntentionPreviewComputable.kt:90)
    at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewComputable.tryCreateDiffContent(IntentionPreviewComputable.kt:66)
    at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewComputable.call(IntentionPreviewComputable.kt:44)
    at com.intellij.codeInsight.intention.impl.preview.IntentionPreviewComputable.call(IntentionPreviewComputable.kt:38)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$OTelMonitor.callWrapped(NonBlockingReadActionImpl.java:851)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$OTelMonitor$MonitoredComputation.call(NonBlockingReadActionImpl.java:883)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.insideReadAction(NonBlockingReadActionImpl.java:604)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$attemptComputation$4(NonBlockingReadActionImpl.java:567)
    at com.intellij.openapi.application.impl.RwLockHolder.tryRunReadAction(RwLockHolder.kt:310)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:958)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runInReadActionWithWriteActionPriority$0(ProgressIndicatorUtils.java:93)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtilService.runActionAndCancelBeforeWrite(ProgressIndicatorUtilService.java:66)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:155)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runWithWriteActionPriority$1(ProgressIndicatorUtils.java:138)
    at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:100)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:217)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:660)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:735)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:691)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:659)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:79)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:202)
    at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:100)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runWithWriteActionPriority(ProgressIndicatorUtils.java:135)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(ProgressIndicatorUtils.java:93)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.attemptComputation(NonBlockingReadActionImpl.java:567)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$transferToBgThread$1(NonBlockingReadActionImpl.java:466)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$transferToBgThread$2(NonBlockingReadActionImpl.java:481)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
    at java.base/java.lang.Thread.run(Thread.java:840)

Additional Context I'm using Bloc plugin version 3.4.0 But there's no option to update to 4.0.0 which I believe has the fix?

felangel commented 1 month ago

Hi @DanMossa 👋 Thanks for opening an issue!

Can you provide a bit more information about why you're not able to upgrade to 4.0.0? It's available on the marketplace at https://plugins.jetbrains.com/plugin/12129-bloc/versions/stable/503090

DanMossa commented 1 month ago

Hi @DanMossa 👋 Thanks for opening an issue!

Can you provide a bit more information about why you're not able to upgrade to 4.0.0? It's available on the marketplace at plugins.jetbrains.com/plugin/12129-bloc/versions/stable/503090

Ah! I believe it's because I'm using IntelliJ IDEA 2024.1 (Ultimate Edition) image

Would it be possible for you to allow this version of IntelliJ?

felangel commented 1 month ago

Ah thanks! Yeah I’ll try to expand the supported versions later today, apologies for the inconvenience!

DanMossa commented 1 month ago

All good! I appreciate it!

felangel commented 1 month ago

Just created v4.0.1 and it should be available in the next day or so (it's pending review atm).