PowerNukkitX / PowerNukkitX-Legacy

GNU General Public License v3.0
6 stars 4 forks source link

A RuntimeException happened while ticking the server #7

Open Mcayear opened 1 year ago

Mcayear commented 1 year ago

🐞 I found a bug

Issue Description: I've come across an issue while monitoring my PowerNukkitX server logs. The logs contain a runtime exception error that I would like to report. Below is the relevant log entry:

08:27:40 [INFO] [-] Mcayear
08:27:40 [INFO] Mcayear[/192.168.137.254:44217] logged out, reason: Timed out
08:36:14 [ERROR] A RuntimeException occurred while ticking the server
java.util.NoSuchElementException: null
        at cn.nukkit.utils.collection.nb.Long2ObjectNonBlockingMap$SnapshotV.next(Long2ObjectNonBlockingMap.java:1147) ~[powernukkitx.jar:?]
        at cn.nukkit.utils.collection.nb.Long2ObjectNonBlockingMap$SnapshotE.next(Long2ObjectNonBlockingMap.java:1410) ~[powernukkitx.jar:?]
        at cn.nukkit.utils.collection.nb.Long2ObjectNonBlockingMap$SnapshotE.next(Long2ObjectNonBlockingMap.java:1395) ~[powernukkitx.jar:?]
        at cn.nukkit.level.Level.unloadChunks(Level.java:4616) ~[powernukkitx.jar:?]
        at cn.nukkit.level.Level.doGarbageCollection(Level.java:4540) ~[powernukkitx.jar:?]
        at cn.nukkit.Server.tickProcessor(Server.java:1168) [powernukkitx.jar:?]
        at cn.nukkit.Server.start(Server.java:1136) [powernukkitx.jar:?]
        at cn.nukkit.Server.<init>(Server.java:967) [powernukkitx.jar:?]
        at cn.nukkit.Nukkit.main(Nukkit.java:160) [powernukkitx.jar:?]

This error occurred during the server tick, leading to an unexpected runtime exception. It appears to be related to the Nukkit server's internal processing.

Steps to Reproduce: I'm unable to provide specific steps to reproduce this issue as it occurred unexpectedly. The logs provided above contain valuable information for debugging.

Server Information:

Additional Information: If you require any additional information or logs to investigate this issue further, please let me know, and I'll provide the necessary details.

AzaleeX commented 12 months ago

Before I can solve your problem, I'm going to need a little more information about the problem you're mentioning.

  1. Have you added acustom mapor a server-generated map by default ?
  2. I can see, there's a timeout from connecting to the server, which could be due to a number of things The connection to the server is too long/If the timeout is direct, it could be due to the server installation.

😓 Sorry for the late reply, but if the problem persists you can always try reinstalling the server, as I've never had this error. It could also be due to a plugin.

Verox001 commented 12 months ago

I got some other people encountering the error and the source is mostly modification of region files during server runtime, because chunks, loaded in NukkitX, cannot be found after their properties have changed. Like AzaleeX pointed out, in some cases you imported a world with corrupted chunks, which also could lead to the error, but I didn't investigate that one further.

Buddelbubi commented 12 months ago

I have the same error. I try to fix it that way: https://github.com/PowerNukkitX/PowerNukkitX/commit/cf87bb37f6d4369b84d62be1bac5d98acf77a671 But I did not test it yet because PNX is currently broken for WaterdogPE. Waiting for my PR.

I have to mention that the map I am using was NOT imported. It was server generated. The server was running for a while. It seems that at some point, unloadQueue.size(); and unloadQueue.fastEntrySet().iterator(); are out of sync. But I cannot explain why this is happening..

This error is pretty critical, since it prevents players from joining when the max player count is set to 1. Players will get a "Server is full" message even though the server is empty.

Mcayear commented 12 months ago

Before I can solve your problem, I'm going to need a little more information about the problem you're mentioning.

  1. Have you added acustom mapor a server-generated map by default ?
  2. I can see, there's a timeout from connecting to the server, which could be due to a number of things The connection to the server is too long/If the timeout is direct, it could be due to the server installation.

😓 Sorry for the late reply, but if the problem persists you can always try reinstalling the server, as I've never had this error. It could also be due to a plugin.

I haven't added custom map; my world was generated by PNX by default.

Regarding the issue of player timeout, we can rule it out since the player exited normally at 08:27:40, while the runtime error occurred at 08:36:14.

Mcayear commented 12 months ago

I have the same error. I try to fix it that way: cf87bb3 But I did not test it yet because PNX is currently broken for WaterdogPE. Waiting for my PR.

I have to mention that the map I am using was NOT imported. It was server generated. The server was running for a while. It seems that at some point, unloadQueue.size(); and unloadQueue.fastEntrySet().iterator(); are out of sync. But I cannot explain why this is happening..

This error is pretty critical, since it prevents players from joining when the max player count is set to 1. Players will get a "Server is full" message even though the server is empty.

In my case, this happens about 10 minutes after all players have offline.

You've given me some food for thought, perhaps this is a block uninstallation issue?

I'm going to investigate further and try to reproduce the issue after setting the max player count to 1.