zielu / GitToolBox

GitToolBox IntelliJ plugin
GNU General Public License v3.0
607 stars 76 forks source link

[BUG] "Write-unsafe context" exception #544

Closed ofry closed 8 months ago

ofry commented 8 months ago

Describe the bug A clear and concise description of what the bug is.

java.lang.Throwable: Write-unsafe context! Model changes are allowed from write-safe contexts only. Please ensure you're using invokeLater/invokeAndWait with a correct modality state (not "any"). See TransactionGuard documentation for details.
  current modality=ModalityState:{[com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog[dialog5,419,258,440x275,layout=java.awt.BorderLayout,APPLICATION_MODAL,title=SSH Confirmation,defaultCloseOperation=DO_NOTHING_ON_CLOSE,rootPane=com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog$DialogRootPane[,0,0,440x275,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=com.intellij.ui.PopupBorder$BaseBorder@77869c28,flags=449,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]]}
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376)
    at com.intellij.openapi.application.TransactionGuardImpl.assertWriteActionAllowed(TransactionGuardImpl.java:136)
    at com.intellij.psi.impl.PsiModificationTrackerImpl.fireEvent(PsiModificationTrackerImpl.java:81)
    at com.intellij.psi.impl.PsiModificationTrackerImpl.incCountersInner(PsiModificationTrackerImpl.java:87)
    at com.intellij.psi.impl.PsiModificationTrackerImpl.treeChanged(PsiModificationTrackerImpl.java:97)
    at com.intellij.psi.impl.PsiManagerImpl.fireEvent(PsiManagerImpl.java:346)
    at com.intellij.psi.impl.PsiManagerImpl.propertyChanged(PsiManagerImpl.java:320)
    at com.intellij.psi.impl.file.impl.FileManagerImpl.firePropertyChangedForUnloadedPsi(FileManagerImpl.java:149)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:975)
    at com.intellij.psi.impl.PsiManagerImpl.dropPsiCaches(PsiManagerImpl.java:93)
    at m233.b.retrigger(SourceFile:20)
    at zielu.gittoolbox.G.c.a.H.a(SourceFile:234)
    at zielu.gittoolbox.G.c.a.H.invoke(SourceFile:219)
    at zielu.gittoolbox.F.g.c(SourceFile:69)
    at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:27)
    at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:194)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:843)
    at com.intellij.openapi.application.impl.ApplicationImpl$4.run(ApplicationImpl.java:463)
    at com.intellij.openapi.application.impl.RwLockHolder.runWithEnabledImplicitRead(RwLockHolder.kt:75)
    at com.intellij.openapi.application.impl.RwLockHolder.runWithImplicitRead(RwLockHolder.kt:67)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWithImplicitRead(ApplicationImpl.java:1436)
    at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:82)
    at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:124)
    at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:44)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:792)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:733)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:761)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:695)
    at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$12(IdeEventQueue.kt:589)
    at com.intellij.openapi.application.impl.RwLockHolder.runWithoutImplicitRead(RwLockHolder.kt:44)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:589)
    at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:72)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:355)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:354)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:793)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:354)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:349)
    at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:1014)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106)
    at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:1014)
    at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:349)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:843)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:391)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:121)
    at java.desktop/java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:191)
    at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:236)
    at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:234)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
    at java.desktop/java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:234)
    at java.desktop/java.awt.Dialog.lambda$show$2(Dialog.java:1081)
    at java.desktop/sun.awt.SunToolkit.performOnMainThreadIfNeeded(SunToolkit.java:2170)
    at java.desktop/java.awt.Dialog.show(Dialog.java:1041)
    at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog.show(DialogWrapperPeerImpl.java:875)
    at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.show(DialogWrapperPeerImpl.java:474)
    at com.intellij.openapi.ui.DialogWrapper.doShow(DialogWrapper.java:1745)
    at com.intellij.openapi.ui.DialogWrapper.show(DialogWrapper.java:1694)
    at com.intellij.ui.messages.AlertMessagesManager.showMessageDialog(AlertMessagesManager.kt:70)
    at com.intellij.ui.messages.MessagesServiceImpl.showMessageDialog(MessagesServiceImpl.java:54)
    at com.jetbrains.rdserver.ui.BackendMessagesService.showMessageDialog(BackendMessagesService.kt:33)
    at com.intellij.openapi.ui.messages.MessagesService.showMessageDialog$default(MessagesService.kt:36)
    at com.intellij.openapi.ui.MessageDialogBuilder$YesNo.show(MessageDialogBuilder.kt:108)
    at com.intellij.openapi.ui.MessageDialogBuilder$YesNo.ask(MessageDialogBuilder.kt:91)
    at com.intellij.openapi.ui.Messages.showYesNoDialog(Messages.java:388)
    at com.intellij.externalProcessAuthHelper.NativeSshGuiAuthenticator.lambda$askConfirmationInput$3(NativeSshGuiAuthenticator.java:128)
    at com.intellij.externalProcessAuthHelper.NativeSshGuiAuthenticator.lambda$askUser$5(NativeSshGuiAuthenticator.java:158)
    at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:194)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:843)
    at com.intellij.openapi.application.impl.ApplicationImpl$4.run(ApplicationImpl.java:463)
    at com.intellij.openapi.application.impl.LaterInvocator$1.run(LaterInvocator.java:101)
    at com.intellij.openapi.application.impl.RwLockHolder.runWithEnabledImplicitRead(RwLockHolder.kt:75)
    at com.intellij.openapi.application.impl.RwLockHolder.runWithImplicitRead(RwLockHolder.kt:67)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWithImplicitRead(ApplicationImpl.java:1436)
    at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:82)
    at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:124)
    at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:44)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:792)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:733)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:761)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:695)
    at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$12(IdeEventQueue.kt:589)
    at com.intellij.openapi.application.impl.RwLockHolder.runWithoutImplicitRead(RwLockHolder.kt:44)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:589)
    at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:72)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:355)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:354)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:793)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:354)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:349)
    at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:1014)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106)
    at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:1014)
    at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:349)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:848)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:391)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

To Reproduce

I don't know which specific dialog throws this exception. Maybe, dialog about SSH fingerprints?

Expected behavior

It should work fine.

Plugin version 500.2.2+233

IDE version

IntelliJ IDEA 2023.3.6 (Ultimate Edition)
Build #IU-233.15026.9, built on March 21, 2024

Runtime version: 17.0.10+1-b1087.23 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 6.5.0-26-generic
GC: G1 Young Generation, G1 Old Generation
Memory: 10240M
Cores: 4
Registry:
  ide.images.show.chessboard=true
Non-Bundled Plugins:
  com.jetbrains.plugins.ini4idea (233.15026.15)
  Batch Scripts Support (1.0.13)
  icu.windea.bbcode (1.8)
  dev.meanmail.plugin.nginx-intellij-plugin-pro (2022.1.1)
  intellij-awk (0.4.3.1)
  com.plugin.image-icon-viewer (1.0.11)
  com.github.obiscr.exceleditor (2024.3.1-222.233)
  nl.bryanderidder.regexrenamefiles (1.2.7)
  com.shuzijun.markdown-editor (2.0.5)
  com.alayouni.ansiHighlight (23.3.1)
  org.intellij.RegexpTester (2.2.0)
  com.github.holgerbrandl.pasteimages/ (1.3.2)
  ru.limydesign.plugins.yandex.translate (0.1.0)
  artsiomch.cmake (233.1.0)
  artsiomch.cmake.plus (233.1.0)
  com.mnw.tabmover (1.5.2)
  ru.ilimurzin.bitrixexcluder (1.1.0)
  com.bruce.intellijplugin.RedisPlugin (2023.10.28)
  com.github.izhangzhihao.intellijgooglesearch (0.0.2)
  com.github.exidcuter.dockerregistryexplorer (1.1.0-stable)
  com.jetbrains.CyanTheme (1.3)
  com.intellij.apacheConfig (233.15026.15)
  com.vexus2.intellij.openingithub (1.0.6)
  org.jetbrains.plugins.stylus (233.11799.172)
  com.mroche.JsonHelper (1.3.2)
  de.ehmkah.projects.imgdiff (1.11.0)
  org.jetbrains.plugins.localization (233.11799.188)
  com.oxygenxml.json.schema.generator (2024.1.0)
  com.devwook.copy_path_helper (1.1.2)
  lermitage.intellij.extra.icons (2024.3.3)
  krasa.IdeaIconPack (1.14)
  man-page-viewer (0.1.1)
  MHCommitMessageTemplate (1.0.3)
  String Manipulation (9.12.0)
  com.jetbrains.space (233.15026.16)
  com.euphoricity.gitignore (0.3)
  GrepConsole (12.25.0-IJ2023.3)
  com.intellij.ml.llm (233.15026.9)
  com.majera.intellij.codereview.bitbucket (2024.1.3.233)
  git-extended-update-index (0.1.3)
  mobi.hsz.idea.gitignore (4.5.2)
  com.jetbrains.packagesearch.intellij-plugin (233.11800.8)
  com.intellij.tide (233.15026.17)
  com.ess.terminal-pro (1.1.9.211)
  Pythonid (233.15026.9)
  net.fhtagn.pycharm.cellmode (1.3.1)
  io.github.guoci.PythonDocumentationLinkProvider (0.1.4)
  org.tonybaloney.security.pycharm-security (1.29.0)
  ru.meanmail.plugins.prettify-python (2022.1)
  ru.meanmail.plugin.django_command_runner (2022.1)
  com.github.kawamataryo.copygithublink (0.5.3)
  com.majera.intellij.codereview.gitlab (2024.1.3.233)
  com.jetbrains.writerside (2024.03.233.14938)
  com.jetbrains.php (233.15026.12)
  com.niclas-van-eyk.laravel-make-integration (2.3.5)
  com.jetbrains.twig (233.15026.15)
  com.xu (1.3)
  com.funivan.idea.phpClean (2023.12.17)
  com.clutcher.comments_highlighter (2024.1.11)
  nl.deschepers.laraveltinker (2.6.1)
  ru.itrack.bitrix (0.2.0)
  com.kalessil.phpStorm.phpInspectionsUltimate-mp (2024.1.1)
  com.jetbrains.php.blade (233.15026.12)
  dev.ekvedaras.laravelquery (4.0.2)
  com.kalessil.phpStorm.yii2inspections (1.0.6)
  org.jetbrains.plugins.phpstorm-remote-interpreter (233.11799.172)
  org.jetbrains.plugins.phpstorm-docker (233.13135.67)
  com.jetbrains.php.framework (233.15026.15)
  com.jetbrains.php.wordPress (233.15026.12)
  ru.vkurdin.idea.php.lambdafolding (0.3.0)
  org.exbin.deltahex.intellij (0.2.9)
  com.wbars.php.folding (1.0.3)
  com.intellij.php.codeigniter3 (0.6.0)
  com.github.woru.options-completion-phpstorm-plugin (0.0.7)
  ru.adelf.idea.dotenv (2024.1)
  com.laravel_idea.plugin (8.1.3.233)
  org.sourcelab.intellij.plugin.PHPDataObjectGenerator (2021.1.16)
  com.eny.i18n (2.6.2)
  net.king2500.plugins.PhpAdvancedAutoComplete (1.1.0)
  de.espend.idea.php.toolbox (6.2.0)
  de.espend.idea.php.annotation (10.0.0)
  fr.adrienbrault.idea.symfony2plugin (2023.1.266)
  de.espend.idea.shopware (4.4.3)
  org.endpointdeps.EndpointDependencies (1.3)
  zielu.gittoolbox (500.2.2+233)
  com.firsttimeinforever.intellij.pdf.viewer.intellij-pdf-viewer (0.15.0)
  Base64 for IDEA and Storm (1.1b)
Kotlin: 233.15026.9-IJ
Current Desktop: KDE

Screenshots If applicable, add screenshots to help explain your problem. Screenshot_20240326_235600

zielu commented 8 months ago

It was caused by async process finish (blame calculation) colliding with modal dialog.

zielu commented 8 months ago

Done in 500.2.3