GlowstoneMC / Glowstone

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

EntityTeleportEvent Error #1048

Closed Rage-GitHub closed 4 years ago

Rage-GitHub commented 5 years ago

Title: EntityTeleportEvent Handler returned an error in console while a player was connected and server was shutting down.

Glowstone build: 2018.9.0.e83d836

When a player is connected to the server and the server initiates a shutdown, the player is kicked but the console returns an error about the EntityTeleportEvent. Unsure why, it appears when a player is connected and the server shuts down while they are connected.

  1. Boot up the server using the provided version
  2. Connect as a player on 1.12.2
  3. Initiate a server shutdown while the player is connected
  4. Review console of shutdown and wait a few seconds
  5. Notice that an error of the EntityTeleportEvent has shown

00:06:38 [WARNING] Interrupted while handling EntityTeleportEvent
java.lang.InterruptedException
        at java.util.concurrent.FutureTask.awaitDone(Unknown Source)
        at java.util.concurrent.FutureTask.get(Unknown Source)
        at net.glowstone.EventFactory.callEvent(EventFactory.java:76)
        at net.glowstone.entity.GlowEntity.teleport(GlowEntity.java:467)
        at net.glowstone.entity.ai.LookAtPlayerTask.end(LookAtPlayerTask.java:66)
        at net.glowstone.entity.ai.EntityTask.reset(EntityTask.java:79)
        at net.glowstone.entity.ai.LookAtPlayerTask.execute(LookAtPlayerTask.java:78)
        at net.glowstone.entity.ai.EntityTask.pulse(EntityTask.java:56)
        at net.glowstone.entity.ai.TaskManager.lambda$pulse$1(TaskManager.java:99)
        at java.lang.Iterable.forEach(Unknown Source)
        at net.glowstone.entity.ai.TaskManager.pulse(TaskManager.java:99)
        at net.glowstone.entity.GlowEntity.pulse(GlowEntity.java:570)
        at net.glowstone.entity.GlowLivingEntity.pulse(GlowLivingEntity.java:285)
        at net.glowstone.entity.GlowAgeable.pulse(GlowAgeable.java:62)
        at net.glowstone.GlowWorld.pulse(GlowWorld.java:476)
        at net.glowstone.scheduler.WorldScheduler$WorldThread.run(WorldScheduler.java:170)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask.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)
DeprecatedLuke commented 5 years ago

Just the "teleport" task being cancelled (due to the way glowstone handles ticking/pulsing) before it finishes it. Two solutions are applicable here:

Side note: the error is harmless, unless you want players to be teleported somewhere before the server is shut down?

mastercoms commented 5 years ago

Why was this closed?

aramperes commented 4 years ago

Context: the event is being fired because an entity's AI was pulsed.

The interruption exception is caught and handled here: https://github.com/GlowstoneMC/Glowstone/blob/2fee1587de0979fea84fc2d67eaf78dd6d504142/src/main/java/net/glowstone/EventFactory.java#L78-L83

Which is why the log level shows as WARNING. This should not affect the server negatively.