GlowstoneMC / Glowstone

A fast, customizable and compatible open source server for Minecraft: Java Edition
https://glowstone.net
Other
1.9k stars 273 forks source link

Death screen timeout #429

Closed lmjcbs closed 6 years ago

lmjcbs commented 7 years ago

Glowstone build: 359

Not respawning ~20s after dying results in a timeout/disconnect.

11:32:47 [INFO] pandanoir died.
11:33:08 [INFO] pandanoir [/127.0.0.1:61614] lost connection
11:33:08 [INFO] pandanoir left the game

Joining the server again brings me back to the death screen and gives an error.

2017-02-27_11 31 33

11:33:18 [SEVERE] Error while executing GlowTask{id=325, plugin=null, sync=true: net.glowstone.net.handler.login.EncryptionKeyResponseHandler$ClientAuthCallback$$Lambda$46/16301328@cf7021}
java.lang.NullPointerException
        at net.glowstone.entity.GlowPlayer.getDisplayName(GlowPlayer.java:1004)
        at net.glowstone.entity.GlowLivingEntity.setHealth(GlowLivingEntity.java:572)
        at net.glowstone.entity.GlowPlayer.setHealth(GlowPlayer.java:1319)
        at net.glowstone.io.entity.LivingEntityStore.load(LivingEntityStore.java:58)
        at net.glowstone.io.entity.HumanEntityStore.load(HumanEntityStore.java:29)
        at net.glowstone.io.entity.PlayerStore.load(PlayerStore.java:38)
        at net.glowstone.io.entity.PlayerStore.load(PlayerStore.java:9)
        at net.glowstone.io.entity.EntityStorage.load(EntityStorage.java:216)
        at net.glowstone.io.nbt.NbtPlayerDataService.readDataImpl(NbtPlayerDataService.java:47)
        at net.glowstone.io.nbt.NbtPlayerDataService.access$100(NbtPlayerDataService.java:28)
        at net.glowstone.io.nbt.NbtPlayerDataService$NbtPlayerReader.readData(NbtPlayerDataService.java:230)
        at net.glowstone.entity.GlowPlayer.join(GlowPlayer.java:370)
        at net.glowstone.net.GlowSession.setPlayer(GlowSession.java:360)
        at net.glowstone.net.handler.login.EncryptionKeyResponseHandler$ClientAuthCallback.lambda$done$0(EncryptionKeyResponseHandler.java:153)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at net.glowstone.scheduler.GlowTask.run(GlowTask.java:167)
        at net.glowstone.scheduler.GlowScheduler.pulse(GlowScheduler.java:152)
        at net.glowstone.scheduler.GlowScheduler.lambda$start$0(GlowScheduler.java:83)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

If I still don't respawn after ~20s of re-joining the server for the first time results in another timeout/disconnect. However joining again after this second timeout/disconnect forces a spawn.

MrPowerGamerBR commented 7 years ago

Can confirm this issue

aramperes commented 7 years ago

I have fixed multiple issues relating to death in 0f4057bc52a9853ee7a45bbb1bc6f9300122ec04, including the error message. Unfortunately, I have not been able to reproduce the disconnection issue. Could you please test it using the latest build?

lmjcbs commented 7 years ago

Glowstone build #360

Disconnect is still present. The error message on rejoin has gone, but it no longer forces spawn like it did after the second rejoin.

13:58:38 [INFO] pandanoir died.
13:58:58 [INFO] pandanoir [/127.0.0.1:55623] lost connection
13:58:58 [INFO] pandanoir left the game
13:59:08 [INFO] pandanoir died.
13:59:08 [INFO] pandanoir [/127.0.0.1:55714] connected, UUID: 1352d980-d417-419c-affa-d9a1c8efeffd
13:59:08 [INFO] pandanoir joined the game
13:59:29 [INFO] pandanoir [/127.0.0.1:55714] lost connection
13:59:29 [INFO] pandanoir left the game
13:59:34 [INFO] pandanoir died.
13:59:34 [INFO] pandanoir [/127.0.0.1:55742] connected, UUID: 1352d980-d417-419c-affa-d9a1c8efeffd
13:59:34 [INFO] pandanoir joined the game
13:59:54 [INFO] pandanoir [/127.0.0.1:55742] lost connection
13:59:54 [INFO] pandanoir left the game
mastercoms commented 7 years ago

Maybe the vanilla client doesn't send packets when dead, so Glowstone thinks it has disconnected? Maybe we should add a isDead check in the lag disconnection loop. However, that would introduce problems when people would actually disconnect while dead.

aramperes commented 7 years ago

Cause appears to be that the "Keep Alive" packet is not sent by the server when the player is dead. That packet (0x1F) should be sent frequently. The client will disconnect itself if the server has not sent a K-A in 20 seconds.

KiuIras commented 6 years ago

I can't reproduce this bug. Maybe is it resolved?

mastercoms commented 6 years ago

Fixed in https://github.com/GlowstoneMC/Glowstone/commit/002bf472a1abb52f8d87e3390b09cd8621aadc7f