Hexworks / zircon

Zircon is an extensible and user-friendly, multiplatform tile engine.
https://hexworks.org/projects/zircon/
Apache License 2.0
755 stars 138 forks source link

java.lang.InterruptedException when holding down key #422

Closed fooberticus closed 1 year ago

fooberticus commented 2 years ago

When running the code from PlayerMoveExampleJava.java, I consistently get this exception.

To reproduce, start the program and hold a direction key (e.g. left) so the character moves all the way across the screen, switch to the other direction if you get near the edge of the screen.

Within maybe 10-20 seconds of holding down a key like this, the exception will be thrown.

[DefaultDispatcher-worker-1] ERROR SwingApplication - Render failed
java.lang.InterruptedException
        at java.base/java.util.concurrent.FutureTask.awaitDone(FutureTask.java:418)
        at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:190)
        at co.touchlab.stately.isolate.BackgroundStateRunner.stateRun(BackgroundStateRunner.kt:18)
        at co.touchlab.stately.isolate.IsoStateKt.createState(IsoState.kt:49)
        at co.touchlab.stately.collections.IsoMutableMap.<init>(IsoMutableMap.kt:8)
        at co.touchlab.stately.collections.IsoMutableMap.<init>(IsoMutableMap.kt:7)
        at io.github.reactivecircus.cache4k.RealCache.<init>(RealCache.kt:39)
        at io.github.reactivecircus.cache4k.RealCache.<init>(RealCache.kt)
        at io.github.reactivecircus.cache4k.CacheBuilderImpl.build(Cache.kt:141)
        at org.hexworks.zircon.internal.util.DefaultCache.<init>(DefaultCache.kt:17)
        at org.hexworks.zircon.internal.util.DefaultCache.<init>(DefaultCache.kt)
        at org.hexworks.zircon.internal.util.DefaultCache.<init>(DefaultCache.kt:9)
        at org.hexworks.zircon.api.util.Cache$Companion.create(Cache.kt:35)
        at org.hexworks.zircon.api.tileset.base.BaseCP437Tileset.<init>(BaseCP437Tileset.kt:42)
        at org.hexworks.zircon.internal.tileset.Java2DCP437Tileset.<init>(Java2DCP437Tileset.kt:27)
        at org.hexworks.zircon.api.SwingApplications$createDefaultFactories$1$1.invoke(SwingApplications.kt:200)
        at org.hexworks.zircon.api.SwingApplications$createDefaultFactories$1$1.invoke(SwingApplications.kt:199)
        at org.hexworks.zircon.internal.tileset.impl.DefaultTilesetFactory.create(DefaultTilesetFactory.kt:16)
        at org.hexworks.zircon.internal.tileset.impl.DefaultTilesetLoader.loadTilesetFrom(DefaultTilesetLoader.kt:26)
        at org.hexworks.zircon.internal.renderer.SwingCanvasRenderer.drawTiles(SwingCanvasRenderer.kt:192)
        at org.hexworks.zircon.internal.renderer.SwingCanvasRenderer.render(SwingCanvasRenderer.kt:150)
        at org.hexworks.zircon.internal.application.impl.BaseApplication.doRender(BaseApplication.kt:130)
        at org.hexworks.zircon.internal.application.impl.BaseApplication.access$doRender(BaseApplication.kt:23)
        at org.hexworks.zircon.internal.application.impl.BaseApplication$startRenderLoop$1.invokeSuspend(BaseApplication.kt:77)
        at org.hexworks.zircon.internal.application.impl.BaseApplication$startRenderLoop$1.invoke(BaseApplication.kt)
        at org.hexworks.zircon.internal.application.impl.BaseApplication$startRenderLoop$1.invoke(BaseApplication.kt)
        at org.hexworks.zircon.internal.application.impl.BaseApplication$1.invokeSuspend(BaseApplication.kt:52)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
fooberticus commented 1 year ago

Oddly enough, I'm not able to reproduce this issue after coming back to it a few months later. It may have been an issue with my environment, which at present is OpenJDK 17 + IntelliJ.

Closing this one.