MovingBlocks / Terasology

Terasology - open source voxel world
http://terasology.org
Apache License 2.0
3.69k stars 1.34k forks source link

Game crash from damage indicator UI in some cases #4909

Open Cervator opened 3 years ago

Cervator commented 3 years ago

What you were trying to do

Test MetalRenegades. Fix is likely needed in the Health module, but maybe hardening against unexpected UI state is something we can help in the engine? If just a quick fix in Health then this is probably a small easy bug to handle.

What actually happened

Local RL baby helped me detect a bug by taking my attention away. Game had main menu up but it was night time and there were MawGooeys around. Came back to a crash I figured happened because one of them hit my character while the main menu was up thus some UI stuff wasn't in the right state to receive a damage effect. Mentally increased the baby's kill score.

How to reproduce

Log details and game version

Latest develop as of the time this is being submitted

14:10:38.883 [main] INFO  o.t.e.p.i.ReadWriteStorageManager - Auto Saving - Snapshot created: Writing phase starts
14:11:38.417 [main] ERROR o.t.engine.core.TerasologyEngine - Uncaught exception, attempting clean game shutdown
java.lang.NullPointerException: null
    at org.terasology.module.health.systems.HealthClientSystem.onDamaged(HealthClientSystem.java:65)
    at org.terasology.module.health.systems.HealthClientSystemMethodAccess.invoke(Unknown Source)
    at org.terasology.engine.entitySystem.event.internal.EventSystemImpl$ByteCodeEventHandlerInfo.invoke(EventSystemImpl.java:379)
    at org.terasology.engine.entitySystem.event.internal.EventSystemImpl.sendStandardEvent(EventSystemImpl.java:244)
    at org.terasology.engine.entitySystem.event.internal.EventSystemImpl.send(EventSystemImpl.java:235)
    at org.terasology.engine.core.bootstrap.eventSystem.AbstractEventSystemDecorator.send(AbstractEventSystemDecorator.java:67)
    at org.terasology.engine.network.NetworkEventSystemDecorator.send(NetworkEventSystemDecorator.java:54)
    at org.terasology.engine.core.bootstrap.eventSystem.AbstractEventSystemDecorator.send(AbstractEventSystemDecorator.java:67)
    at org.terasology.engine.recording.RecordingEventSystemDecorator.send(RecordingEventSystemDecorator.java:34)
    at org.terasology.engine.entitySystem.entity.internal.BaseEntityRef.send(BaseEntityRef.java:190)
    at org.terasology.module.health.systems.DamageAuthoritySystem.doDamage(DamageAuthoritySystem.java:101)
    at org.terasology.module.health.systems.DamageAuthoritySystem.checkDamage(DamageAuthoritySystem.java:130)
    at org.terasology.module.health.systems.DamageAuthoritySystem.onDamage(DamageAuthoritySystem.java:116)
    at org.terasology.module.health.systems.DamageAuthoritySystemMethodAccess.invoke(Unknown Source)
    at org.terasology.engine.entitySystem.event.internal.EventSystemImpl$ByteCodeEventHandlerInfo.invoke(EventSystemImpl.java:379)
    at org.terasology.engine.entitySystem.event.internal.EventSystemImpl.sendStandardEvent(EventSystemImpl.java:244)
    at org.terasology.engine.entitySystem.event.internal.EventSystemImpl.send(EventSystemImpl.java:235)
    at org.terasology.engine.core.bootstrap.eventSystem.AbstractEventSystemDecorator.send(AbstractEventSystemDecorator.java:67)
    at org.terasology.engine.network.NetworkEventSystemDecorator.send(NetworkEventSystemDecorator.java:54)
    at org.terasology.engine.core.bootstrap.eventSystem.AbstractEventSystemDecorator.send(AbstractEventSystemDecorator.java:67)
    at org.terasology.engine.recording.RecordingEventSystemDecorator.send(RecordingEventSystemDecorator.java:34)
    at org.terasology.engine.entitySystem.entity.internal.BaseEntityRef.send(BaseEntityRef.java:190)
    at org.terasology.thirst.ThirstAuthoritySystem.onPeriodicActionTriggered(ThirstAuthoritySystem.java:108)
    at org.terasology.thirst.ThirstAuthoritySystemMethodAccess.invoke(Unknown Source)
    at org.terasology.engine.entitySystem.event.internal.EventSystemImpl$ByteCodeEventHandlerInfo.invoke(EventSystemImpl.java:379)
    at org.terasology.engine.entitySystem.event.internal.EventSystemImpl.sendStandardEvent(EventSystemImpl.java:244)
    at org.terasology.engine.entitySystem.event.internal.EventSystemImpl.send(EventSystemImpl.java:235)
    at org.terasology.engine.core.bootstrap.eventSystem.AbstractEventSystemDecorator.send(AbstractEventSystemDecorator.java:67)
    at org.terasology.engine.network.NetworkEventSystemDecorator.send(NetworkEventSystemDecorator.java:54)
    at org.terasology.engine.core.bootstrap.eventSystem.AbstractEventSystemDecorator.send(AbstractEventSystemDecorator.java:67)
    at org.terasology.engine.recording.RecordingEventSystemDecorator.send(RecordingEventSystemDecorator.java:34)
    at org.terasology.engine.entitySystem.entity.internal.BaseEntityRef.send(BaseEntityRef.java:190)
    at org.terasology.engine.logic.delay.DelayedActionSystem.lambda$invokePeriodicOperations$1(DelayedActionSystem.java:114)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
    at java.util.LinkedList$LLSpliterator.forEachRemaining(LinkedList.java:1235)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    at org.terasology.engine.logic.delay.DelayedActionSystem.invokePeriodicOperations(DelayedActionSystem.java:101)
    at org.terasology.engine.logic.delay.DelayedActionSystem.update(DelayedActionSystem.java:50)
    at org.terasology.engine.core.modes.StateIngame.update(StateIngame.java:179)
    at org.terasology.engine.core.TerasologyEngine.tick(TerasologyEngine.java:500)
    at org.terasology.engine.core.TerasologyEngine.mainLoop(TerasologyEngine.java:460)
    at org.terasology.engine.core.TerasologyEngine.runMain(TerasologyEngine.java:436)
    at org.terasology.engine.core.TerasologyEngine.run(TerasologyEngine.java:402)
    at org.terasology.engine.Terasology.call(Terasology.java:207)
    at org.terasology.engine.Terasology.call(Terasology.java:70)
    at picocli.CommandLine.executeUserObject(CommandLine.java:1933)
    at picocli.CommandLine.access$1200(CommandLine.java:145)
    at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2332)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2326)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2291)
    at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2159)
    at picocli.CommandLine.execute(CommandLine.java:2058)
    at org.terasology.engine.Terasology.main(Terasology.java:139)
14:11:38.418 [main] INFO  o.t.engine.core.TerasologyEngine - Shutting down Terasology...
14:11:38.820 [main] INFO  o.t.e.p.i.ReadWriteStorageManager - Saving - Creating game snapshot
14:11:38.845 [main] DEBUG reactor.util.Loggers - Using Slf4j logging framework
Cervator commented 3 years ago

On the other hand it seemingly just happened again, just flying around too fast in MedievalCities, no main menu involved:

16:13:19.183 [main] INFO  o.t.engine.logic.console.ConsoleImpl - [CONSOLE] High-speed mode activated
16:13:21.027 [main] INFO  o.t.engine.logic.console.ConsoleImpl - [CONSOLE] Flight mode toggled
16:13:34.092 [main] ERROR o.t.engine.core.TerasologyEngine - Uncaught exception, attempting clean game shutdown
java.lang.NullPointerException: null
    at org.terasology.module.health.systems.HealthClientSystem.onDamaged(HealthClientSystem.java:65)
    at org.terasology.module.health.systems.HealthClientSystemMethodAccess.invoke(Unknown Source)
    at org.terasology.engine.entitySystem.event.internal.EventSystemImpl$ByteCodeEventHandlerInfo.invoke(EventSystemImpl.java:379)
    at org.terasology.engine.entitySystem.event.internal.EventSystemImpl.sendStandardEvent(EventSystemImpl.java:244)
    at org.terasology.engine.entitySystem.event.internal.EventSystemImpl.send(EventSystemImpl.java:235)
    at org.terasology.engine.core.bootstrap.eventSystem.AbstractEventSystemDecorator.send(AbstractEventSystemDecorator.java:67)
    at org.terasology.engine.network.NetworkEventSystemDecorator.send(NetworkEventSystemDecorator.java:54)
    at org.terasology.engine.core.bootstrap.eventSystem.AbstractEventSystemDecorator.send(AbstractEventSystemDecorator.java:67)
    at org.terasology.engine.recording.RecordingEventSystemDecorator.send(RecordingEventSystemDecorator.java:34)
    at org.terasology.engine.entitySystem.entity.internal.BaseEntityRef.send(BaseEntityRef.java:190)
    at org.terasology.module.health.systems.DamageAuthoritySystem.doDamage(DamageAuthoritySystem.java:101)
    at org.terasology.module.health.systems.DamageAuthoritySystem.checkDamage(DamageAuthoritySystem.java:130)
    at org.terasology.module.health.systems.DamageAuthoritySystem.highSpeedDamage(DamageAuthoritySystem.java:211)
    at org.terasology.module.health.systems.DamageAuthoritySystem.onLand(DamageAuthoritySystem.java:189)
    at org.terasology.module.health.systems.DamageAuthoritySystemMethodAccess.invoke(Unknown Source)
    at org.terasology.engine.entitySystem.event.internal.EventSystemImpl$ByteCodeEventHandlerInfo.invoke(EventSystemImpl.java:379)
    at org.terasology.engine.entitySystem.event.internal.EventSystemImpl.sendStandardEvent(EventSystemImpl.java:244)
    at org.terasology.engine.entitySystem.event.internal.EventSystemImpl.send(EventSystemImpl.java:235)
    at org.terasology.engine.core.bootstrap.eventSystem.AbstractEventSystemDecorator.send(AbstractEventSystemDecorator.java:67)
    at org.terasology.engine.network.NetworkEventSystemDecorator.send(NetworkEventSystemDecorator.java:54)
    at org.terasology.engine.core.bootstrap.eventSystem.AbstractEventSystemDecorator.send(AbstractEventSystemDecorator.java:67)
    at org.terasology.engine.recording.RecordingEventSystemDecorator.send(RecordingEventSystemDecorator.java:34)
    at org.terasology.engine.entitySystem.entity.internal.BaseEntityRef.send(BaseEntityRef.java:190)
    at org.terasology.engine.logic.characters.KinematicCharacterMover.walk(KinematicCharacterMover.java:677)
    at org.terasology.engine.logic.characters.KinematicCharacterMover.updatePosition(KinematicCharacterMover.java:553)
    at org.terasology.engine.logic.characters.KinematicCharacterMover.step(KinematicCharacterMover.java:85)
    at org.terasology.engine.logic.characters.ServerCharacterPredictionSystem.stepState(ServerCharacterPredictionSystem.java:189)
    at org.terasology.engine.logic.characters.ServerCharacterPredictionSystem.onPlayerInput(ServerCharacterPredictionSystem.java:136)
    at org.terasology.engine.logic.characters.ServerCharacterPredictionSystemMethodAccess.invoke(Unknown Source)
    at org.terasology.engine.entitySystem.event.internal.EventSystemImpl$ByteCodeEventHandlerInfo.invoke(EventSystemImpl.java:379)
    at org.terasology.engine.entitySystem.event.internal.EventSystemImpl.sendStandardEvent(EventSystemImpl.java:244)
    at org.terasology.engine.entitySystem.event.internal.EventSystemImpl.send(EventSystemImpl.java:235)
    at org.terasology.engine.core.bootstrap.eventSystem.AbstractEventSystemDecorator.send(AbstractEventSystemDecorator.java:67)
    at org.terasology.engine.network.NetworkEventSystemDecorator.send(NetworkEventSystemDecorator.java:54)
    at org.terasology.engine.core.bootstrap.eventSystem.AbstractEventSystemDecorator.send(AbstractEventSystemDecorator.java:67)
    at org.terasology.engine.recording.RecordingEventSystemDecorator.send(RecordingEventSystemDecorator.java:34)
    at org.terasology.engine.entitySystem.entity.internal.BaseEntityRef.send(BaseEntityRef.java:190)
    at org.terasology.engine.logic.players.LocalPlayerSystem.processInput(LocalPlayerSystem.java:175)
    at org.terasology.engine.logic.players.LocalPlayerSystem.update(LocalPlayerSystem.java:134)
    at org.terasology.engine.core.modes.StateIngame.update(StateIngame.java:179)
    at org.terasology.engine.core.TerasologyEngine.tick(TerasologyEngine.java:500)
    at org.terasology.engine.core.TerasologyEngine.mainLoop(TerasologyEngine.java:460)
    at org.terasology.engine.core.TerasologyEngine.runMain(TerasologyEngine.java:436)
    at org.terasology.engine.core.TerasologyEngine.run(TerasologyEngine.java:402)
    at org.terasology.engine.Terasology.call(Terasology.java:207)
    at org.terasology.engine.Terasology.call(Terasology.java:70)
    at picocli.CommandLine.executeUserObject(CommandLine.java:1933)
    at picocli.CommandLine.access$1200(CommandLine.java:145)
    at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2332)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2326)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2291)
    at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2159)
    at picocli.CommandLine.execute(CommandLine.java:2058)
    at org.terasology.engine.Terasology.main(Terasology.java:139)
16:13:34.092 [main] INFO  o.t.engine.core.TerasologyEngine - Shutting down Terasology...
16:13:34.614 [main] INFO  o.t.e.p.i.ReadWriteStorageManager - Saving - Creating game snapshot
16:13:34.642 [main] DEBUG reactor.util.Loggers - Using Slf4j logging framework
Cervator commented 3 years ago

Also noticed this during startup logging on entering a world:

16:33:22.411 [main] INFO  o.t.e.i18n.TranslationSystemImpl - Discovered CoreAdvancedAssets:game
16:33:22.436 [main] INFO  o.t.p.c.PathfinderSystem - PathfinderSystem started
16:33:22.562 [main] ERROR o.t.e.core.ComponentSystemManager - Failed to initialise system org.terasology.module.health.systems.HealthClientSystem@4d2eebd1
java.lang.ClassCastException: org.terasology.rendering.nui.layers.hud.DirectionalDamageOverlay cannot be cast to org.terasology.module.health.ui.DirectionalDamageOverlay
        at org.terasology.module.health.systems.HealthClientSystem.initialise(HealthClientSystem.java:39)
        at org.terasology.engine.core.ComponentSystemManager.initialiseSystem(ComponentSystemManager.java:211)
        at org.terasology.engine.core.ComponentSystemManager.initialise(ComponentSystemManager.java:194)
        at org.terasology.engine.core.modes.loadProcesses.InitialiseSystems.step(InitialiseSystems.java:36)
        at org.terasology.engine.core.modes.StateLoading.update(StateLoading.java:242)
        at org.terasology.engine.core.TerasologyEngine.tick(TerasologyEngine.java:500)
        at org.terasology.engine.core.TerasologyEngine.mainLoop(TerasologyEngine.java:460)
        at org.terasology.engine.core.TerasologyEngine.runMain(TerasologyEngine.java:436)
        at org.terasology.engine.core.TerasologyEngine.run(TerasologyEngine.java:402)
        at org.terasology.engine.Terasology.call(Terasology.java:207)
        at org.terasology.engine.Terasology.call(Terasology.java:70)
        at picocli.CommandLine.executeUserObject(CommandLine.java:1933)
        at picocli.CommandLine.access$1200(CommandLine.java:145)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2332)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2326)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2291)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2159)
        at picocli.CommandLine.execute(CommandLine.java:2058)
        at org.terasology.engine.Terasology.main(Terasology.java:139)
16:33:22.646 [main] INFO  o.t.e.w.b.internal.BlockManagerImpl - Registered BlockFamily[freeform,StructuralResources:StoneBlocks]
16:33:22.647 [main] INFO  o.t.e.w.b.internal.BlockManagerImpl - Registered Block StructuralResources:StoneBlocks with id 109
jdrueckert commented 2 years ago

fyi @skaldarnar

skaldarnar commented 2 years ago

I need to investigate the NullPointerException more to figure out whether the implementation is missing a check there (https://github.com/MovingBlocks/Terasology/issues/4909#issuecomment-922374801).

The ClassCastException issue (https://github.com/MovingBlocks/Terasology/issues/4909#issuecomment-922376970) seems to be an issue of renaming? 🤔 I need to check whether I forgot to change a reference, or whether that is an issue from loading a game state with (active?) damage overlay from an older version...