typedb / typedb-studio

TypeDB Studio (IDE)
https://typedb.com
Mozilla Public License 2.0
195 stars 44 forks source link

Text editor crashes when opened file was deleted by another program #669

Open izmalk opened 1 year ago

izmalk commented 1 year ago

Description

Typed DB Studio crashes when you delete file in another program.

Environment

  1. TypeDB version: 2.13
  2. OS of TypeDB server: MacOS 12.6.1
  3. Studio version: 2.11
  4. OS of Studio: MacOS 12.6.1
  5. Other environment details:

Reproducible Steps

I can't reproduce this one, but that's how it happened:

  1. TypeDB Studio was opened in background, showing some schema visualization and multiple tabs.
  2. I was working in IntelliJ IDEA and deleted one of the files in the project directory (chema_backup.tql).
  3. Some time has passed. I was working with IntelliJ IDEA, sometimes checking TypeDB Studio.
  4. At one moment I switched to the Studio window and clicked on one of the tabs to switch to it (I don't remember what tab it was, unfortunately). Immediately got crashed.

Expected Output

Continue working without crashing.

Actual Output

Crashed.

Additional information

Crash info:

Title: /Users/izmalk/test2/bookstore/typedb-examples/commerce/bookstore/schema_backup.tql (No such file or directory)
Trace: java.io.FileNotFoundException: /Users/izmalk/test2/bookstore/typedb-examples/commerce/bookstore/schema_backup.tql (No such file or directory)
    at java.base/java.io.FileInputStream.open0(Native Method)
    at java.base/java.io.FileInputStream.open(Unknown Source)
    at java.base/java.io.FileInputStream.<init>(Unknown Source)
    at com.vaticle.typedb.studio.state.project.FileState.loadBinaryFileLines(FileState.kt:213)
    at com.vaticle.typedb.studio.state.project.FileState.readContent(FileState.kt:201)
    at com.vaticle.typedb.studio.framework.editor.TextEditor$State.reloadContent$framework_editor_editor(TextEditor.kt:235)
    at com.vaticle.typedb.studio.framework.editor.TextEditor.createState-rAjV9yQ(TextEditor.kt:129)
    at com.vaticle.typedb.studio.module.project.FilePage$Companion.create(FilePage.kt:54)
    at com.vaticle.typedb.studio.ComposableSingletons$StudioKt$lambda-2$1$2.invoke(Studio.kt:171)
    at com.vaticle.typedb.studio.ComposableSingletons$StudioKt$lambda-2$1$2.invoke(Studio.kt:166)
    at com.vaticle.typedb.studio.framework.material.Pages$State.openedPage$framework_material_material(Pages.kt:89)
    at com.vaticle.typedb.studio.framework.material.Pages$Layout$3$1.invoke(Pages.kt:183)
    at com.vaticle.typedb.studio.framework.material.Pages$Layout$3$1.invoke(Pages.kt:180)
    at com.vaticle.typedb.studio.framework.material.Tabs$Horizontal.Layout(Tabs.kt:203)
    at com.vaticle.typedb.studio.framework.material.Pages.Layout(Pages.kt:180)
    at com.vaticle.typedb.studio.framework.material.Pages$Layout$5.invoke(Pages.kt)
    at com.vaticle.typedb.studio.framework.material.Pages$Layout$5.invoke(Pages.kt)
    at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:140)
    at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2158)
    at androidx.compose.runtime.ComposerImpl.skipToGroupEnd(Composer.kt:2427)
    at androidx.compose.ui.ComposeScene$setContent$5.invoke(ComposeScene.skiko.kt:310)
    at androidx.compose.ui.ComposeScene$setContent$5.invoke(ComposeScene.skiko.kt:306)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
    at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
    at androidx.compose.ui.platform.CompositionLocalsKt.ProvideCommonCompositionLocals(CompositionLocals.kt:166)
    at androidx.compose.ui.platform.Wrapper_skikoKt$setContent$2$1.invoke(Wrapper.skiko.kt:47)
    at androidx.compose.ui.platform.Wrapper_skikoKt$setContent$2$1.invoke(Wrapper.skiko.kt:46)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
    at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
    at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:248)
    at androidx.compose.ui.platform.Wrapper_skikoKt.provide(Wrapper.skiko.kt:63)
    at androidx.compose.ui.platform.Wrapper_skikoKt.access$provide(Wrapper.skiko.kt:1)
    at androidx.compose.ui.platform.Wrapper_skikoKt$setContent$2.invoke(Wrapper.skiko.kt:46)
    at androidx.compose.ui.platform.Wrapper_skikoKt$setContent$2.invoke(Wrapper.skiko.kt:45)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
    at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:140)
    at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2158)
    at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:2404)
    at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:2585)
    at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:2571)
    at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:247)
    at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source)
    at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:2571)
    at androidx.compose.runtime.ComposerImpl.recompose$runtime(Composer.kt:2547)
    at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:620)
    at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:786)
    at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:105)
    at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:456)
    at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:425)
    at androidx.compose.runtime.BroadcastFrameClock$FrameAwaiter.resume(BroadcastFrameClock.kt:42)
    at androidx.compose.runtime.BroadcastFrameClock.sendFrame(BroadcastFrameClock.kt:71)
    at androidx.compose.ui.ComposeScene.render(ComposeScene.skiko.kt:351)
    at androidx.compose.ui.awt.ComposeLayer$1$onRender$1.invoke(ComposeLayer.desktop.kt:229)
    at androidx.compose.ui.awt.ComposeLayer$1$onRender$1.invoke(ComposeLayer.desktop.kt:227)
    at androidx.compose.ui.awt.ComposeLayer.catchExceptions(ComposeLayer.desktop.kt:89)
    at androidx.compose.ui.awt.ComposeLayer.access$catchExceptions(ComposeLayer.desktop.kt:70)
    at androidx.compose.ui.awt.ComposeLayer$1.onRender(ComposeLayer.desktop.kt:227)
    at org.jetbrains.skiko.SkiaLayer.update$skiko(SkiaLayer.awt.kt:438)
    at org.jetbrains.skiko.redrawer.MetalRedrawer.update(MetalRedrawer.kt:66)
    at org.jetbrains.skiko.redrawer.MetalRedrawer.access$update(MetalRedrawer.kt:13)
    at org.jetbrains.skiko.redrawer.MetalRedrawer$frameDispatcher$1.invokeSuspend(MetalRedrawer.kt:38)
    at org.jetbrains.skiko.redrawer.MetalRedrawer$frameDispatcher$1.invoke(MetalRedrawer.kt)
    at org.jetbrains.skiko.redrawer.MetalRedrawer$frameDispatcher$1.invoke(MetalRedrawer.kt)
    at org.jetbrains.skiko.FrameDispatcher$job$1.invokeSuspend(FrameDispatcher.kt:33)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
    at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
    at java.base/java.security.AccessController.doPrivileged(Unknown Source)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
jamesreprise commented 1 year ago

I haven't been able to replicate this issue unfortunately. Studio works exactly as expected, including with the deleted file being in a tab (but not opened). When the file was deleted, the tab disappeared.