typedb / typedb-studio

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

Text editor crashes when opened file was changed in another program #673

Open izmalk opened 1 year ago

izmalk commented 1 year ago

Description

TypeDB opened with some tabs in background. I was working in IntelliJ IDEA. Made some changes in schema.tql, then switched back to Studio and immediately clicked on schema.tql file tab.

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 was not able to recreate the crash. But here is what I did at the time:

  1. Open Type DB Studio. Open schema.tql and some other files. Switch to some other tab, not schema.
  2. Work in IntelliJ IDEA with schema.tql (added attributes).
  3. Alt+TAB back to TypeDB Studio and immediately click on schema.tql to switch to it.

Expected Output

Open schema.tql in studio.

Actual Output

Crash.

Additional information

Title: Unsupported concurrent change during composition. A state object was modified by composition as well as being modified outside composition.
Trace: java.lang.IllegalStateException: Unsupported concurrent change during composition. A state object was modified by composition as well as being modified outside composition.
    at androidx.compose.runtime.Recomposer.applyAndCheck(Recomposer.kt:825)
    at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:1092)
    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 reproduce this issue unfortunately. I've tried following the steps multiple times but Studio behaves as expected. It's possible there is a race condition involved: @izmalk could you provide the CPU model of the device you had this error occur on?

If we can uncover any race condition here, it is likely that the same is the case for

as well.

izmalk commented 1 year ago

I haven't been able to reproduce this issue unfortunately. I've tried following the steps multiple times but Studio behaves as expected. It's possible there is a race condition involved: @izmalk could you provide the CPU model of the device you had this error occur on?

as well.

2,3 GHz 8‑core CPU Intel Core i9 Снимок экрана 2022-12-08 в 17 08 44

izmalk commented 1 year ago

I have not experienced these crashes in the 2.14.1 version yet. I will continue to monitor the situation. One of the factors that could influence this - is software compatibility. I'm using a GitHub desktop app that could have managed files at the wrong time. I'm also using Grammarly which is probably trying to access the text editor. Also, Grammarly isn't working in the Studio, but it doesn't mean it is not trying and can't influence it in some way.

izmalk commented 1 year ago

I haven't been able to reproduce this issue unfortunately. I've tried following the steps multiple times but Studio behaves as expected. It's possible there is a race condition involved: @izmalk could you provide the CPU model of the device you had this error occur on?

If we can uncover any race condition here, it is likely that the same is the case for

as well.

Just got the same crash. Studio 2.14.2. I have edited the schema.tql a bit. In IntelliJ IDEA. Снимок экрана 2022-12-09 в 20 11 23 And switched to Studio. Nothing bad happened. Until I switched to the schema.tql tab. And then it crashed. Снимок экрана 2022-12-09 в 20 10 15

Title: Unsupported concurrent change during composition. A state object was modified by composition as well as being modified outside composition.
Trace: java.lang.IllegalStateException: Unsupported concurrent change during composition. A state object was modified by composition as well as being modified outside composition.
    at androidx.compose.runtime.Recomposer.applyAndCheck(Recomposer.kt:825)
    at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:1092)
    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)
izmalk commented 1 year ago

schema.tql.zip Uploaded the schema file just in case it could be useful.

izmalk commented 1 year ago

After pushing the "Reopen" button I got the following notification (yellow): [PRJ25] TypeDB Studio Project: Content of file /Users/izmalk/test2/bookstore/typedb-examples/commerce/bookstore/schema.tql on the filesystem has changed, and has been reloaded in Studio.

jamesreprise commented 1 year ago

I haven't been able to replicate this issue, but will keep this series of issues open in case we see any similar issue re-occur or occur for other users: