Since 1e7f9214cc2025ad1c12a9967200a35b63155e5d it's no longer possible for an entity to exist in unloaded chunks.
This causes the entity to be closed, and in the case of a player teleporting to unloaded chunks, causes the server to crash.
/tp to an ungenerated area of the mapIt looks like this also happens to newly spawned players, I just setup a fresh 4.0 server and tried to join and got an unloaded chunks crash.
no
In such cases, I suggest temporarily creating an empty chunk
After first generated world by pocketmine, players can't join for second.
Cannot add an Entity in an ungenerated chunk
15:37:17.851 INFO > [NetworkSession: 127.0.0.1 52196] Session opened
string(55) "called : pocketmine\event\server\DataPacketReceiveEvent"
15:37:17.894 INFO > [NetworkSession: 127.0.0.1 52196] Player: Eren5960
string(52) "called : pocketmine\event\player\PlayerPreLoginEvent"
15:37:17.972 DEBUG > [NetworkSession: Eren5960] Xbox Live authenticated: YES
string(52) "called : pocketmine\event\server\DataPacketSendEvent"
15:37:17.973 DEBUG > [NetworkSession: Eren5960] Initiating resource packs phase
string(52) "called : pocketmine\event\server\DataPacketSendEvent"
15:37:17.975 DEBUG > [NetworkSession: Eren5960] Waiting for client to accept resource packs
string(55) "called : pocketmine\event\server\DataPacketReceiveEvent"
15:37:18.064 DEBUG > [NetworkSession: Eren5960] Unhandled ClientCacheStatusPacket: gQEB
string(55) "called : pocketmine\event\server\DataPacketReceiveEvent"
string(52) "called : pocketmine\event\server\DataPacketSendEvent"
15:37:18.117 DEBUG > [NetworkSession: Eren5960] Applying resource pack stack
string(53) "called : pocketmine\event\server\QueryRegenerateEvent"
string(55) "called : pocketmine\event\server\DataPacketReceiveEvent"
15:37:18.405 DEBUG > [NetworkSession: Eren5960] Resource packs sequence completed
string(52) "called : pocketmine\event\player\PlayerCreationEvent"
15:37:18.437 CRITICAL > InvalidArgumentException: "Cannot add an Entity in an ungenerated chunk" (EXCEPTION) in "pmsrc/src/world/World" at line 2174
15:37:18.443 CRITICAL > #0 pmsrc/src/entity/Entity(246): pocketmine\world\World->addEntity(object pocketmine\player\Player)
15:37:18.444 CRITICAL > #1 pmsrc/src/entity/Human(93): pocketmine\entity\Entity->__construct(object pocketmine\entity\Location, object pocketmine\nbt\tag\CompoundTag)
15:37:18.444 CRITICAL > #2 pmsrc/src/player/Player(312): pocketmine\entity\Human->__construct(object pocketmine\entity\Location, object DaPigGuy\PiggyPersonaSkins\skin\PiggySkin, object pocketmine\nbt\tag\CompoundTag)
15:37:18.445 CRITICAL > #3 pmsrc/src/Server(592): pocketmine\player\Player->__construct(object pocketmine\Server, object pocketmine\network\mcpe\NetworkSession, object pocketmine\player\XboxLivePlayerInfo, boolean 1, object pocketmine\nbt\tag\CompoundTag)
15:37:18.445 CRITICAL > #4 pmsrc/src/network/mcpe/NetworkSession(232): pocketmine\Server->createPlayer(object pocketmine\network\mcpe\NetworkSession, object pocketmine\player\XboxLivePlayerInfo, boolean 1)
15:37:18.446 CRITICAL > #5 pmsrc/src/network/mcpe/NetworkSession(639): pocketmine\network\mcpe\NetworkSession->createPlayer()
15:37:18.449 CRITICAL > #6 pmsrc/src/network/mcpe/NetworkSession(634): pocketmine\network\mcpe\NetworkSession->beginSpawnSequence()
15:37:18.450 CRITICAL > #7 pmsrc/src/network/mcpe/handler/ResourcePacksPacketHandler(136): pocketmine\network\mcpe\NetworkSession->pocketmine\network\mcpe\{closure}()
15:37:18.450 CRITICAL > #8 pmsrc/src/network/mcpe/protocol/ResourcePackClientResponsePacket(61): pocketmine\network\mcpe\handler\ResourcePacksPacketHandler->handleResourcePackClientResponse(object pocketmine\network\mcpe\protocol\ResourcePackClientResponsePacket)
15:37:18.454 CRITICAL > #9 pmsrc/src/network/mcpe/NetworkSession(384): pocketmine\network\mcpe\protocol\ResourcePackClientResponsePacket->handle(object pocketmine\network\mcpe\handler\ResourcePacksPacketHandler)
15:37:18.454 CRITICAL > #10 pmsrc/src/network/mcpe/NetworkSession(343): pocketmine\network\mcpe\NetworkSession->handleDataPacket(object pocketmine\network\mcpe\protocol\ResourcePackClientResponsePacket)
15:37:18.455 CRITICAL > #11 pmsrc/src/network/mcpe/raklib/RakLibInterface(185): pocketmine\network\mcpe\NetworkSession->handleEncoded(string[7] c.`a`..)
15:37:18.455 CRITICAL > #12 pmsrc/vendor/pocketmine/raklib/src/server/ipc/RakLibToUserThreadMessageReceiver(43): pocketmine\network\mcpe\raklib\RakLibInterface->onPacketReceive(integer 0, string[8] .c.`a`..)
15:37:18.456 CRITICAL > #13 pmsrc/src/network/mcpe/raklib/RakLibInterface(120): raklib\server\ipc\RakLibToUserThreadMessageReceiver->handle(object pocketmine\network\mcpe\raklib\RakLibInterface)
15:37:18.456 CRITICAL > #14 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(123): pocketmine\network\mcpe\raklib\RakLibInterface->pocketmine\network\mcpe\raklib\{closure}()
15:37:18.456 CRITICAL > #15 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(85): pocketmine\snooze\SleeperHandler->processNotifications()
15:37:18.457 CRITICAL > #16 pmsrc/src/Server(1521): pocketmine\snooze\SleeperHandler->sleepUntil(double 1612010238.4043)
15:37:18.457 CRITICAL > #17 pmsrc/src/Server(1071): pocketmine\Server->tickProcessor()
15:37:18.457 CRITICAL > #18 pmsrc/src/PocketMine(248): pocketmine\Server->__construct(object BaseClassLoader, object pocketmine\utils\MainLogger, string[37] C:\Users\ahmed\Desktop\RedMC\Builder\, string[45] C:\Users\ahmed\Desktop\RedMC\Builder\plugins\)
15:37:18.458 CRITICAL > #19 pmsrc/src/PocketMine(272): pocketmine\server()
15:37:18.458 EMERGENCY > An unrecoverable error has occurred and the server has crashed. Creating a crash dump
Get your spoons out of here please.
This was a spam comment. Made with
PiBHZXQgeW91ciBzcG9vbnMgb3V0IG9mIGhlcmUgcGxlYXNlLg0KDQpZZXMgSSBmdWNraW5nIGZv cmtlZCAib3BlbiBzb3VyY2UiIHByb2plY3Q=
Disclaimer: This was not detected by a bot. This was detected by a magic from a no life no-life iron(II) thiooxide who watch the issue tracker all day very disrespectfully.
Issues that you encounter on your modified server are not helpful or relevant to this issue tracker, regardless of how similar they look to this issue. Unless you are using PocketMine-MP, unmodified, I can't assume that the information you provide is of any use because of the prevalent incompetence of spoon developers.
test
$chunkVersionRaw = $this->db->get($index . self::TAG_VERSION);
if($chunkVersionRaw === false){
var_dump("chunk version raw null");
return null;
}
console
string(22) "chunk version raw null"
14:12:44.394 CRITICAL > InvalidArgumentException: "Cannot add an Entity in an ungenerated chunk" (EXCEPTION) in "pmsrc/src/world/World" at line 2174
I don't care if this issue occurs on your fork because I'm not going to debug your fork. I don't know how I can make it more clear than that. I don't need proof that this issue occurs on your fork, I simply need information that comes from PocketMine-MP unmodified.
In any case, this discussion is a waste of time since the issue is already known (as indicated by its Debugged label). I just don't have a suitable fix for it yet.
For clarity: The reason this is problematic to fix is because it requires being able to wait on the async generation of chunks, so that the player doesn't try to spawn before chunks are available. This is difficult because right now there are circumstances where a chunk generation order can fail, such as when the chunk is locked for use for generating another chunk, like this: https://github.com/pmmp/PocketMine-MP/blob/master/src/world/World.php#L2632
This means that right now, it's not practical to implement a simple promise to solve this problem.
The solution to this problem is probably to create a chunk generation order queue. As well as providing an eventual guarantee that a chunk will be generated even if the request cannot be initiated right now, it would also make it easier to generate chunks from a plugin, since there would be no failure conditions requiring you to keep spamming chunk requests.
However, this comes with its own problems: it would be necessary for the player to also cancel any unfulfilled generation requests on movement and on disconnection, so this would create a non-insignificant amount of extra complexity.
My current plan to solve this problem is to have chunk generation requests bound to chunk loaders. Similarly to how chunks are unloaded when 0 loaders are using a chunk, 0 loaders using a chunk which is requested for generation would cause the generation request to be aborted.
While this is somewhat cumbersome for procedurally generating terrain from a plugin, it's arguably better than the current system, and also solves this problem as an added bonus.
Most helpful comment
My current plan to solve this problem is to have chunk generation requests bound to chunk loaders. Similarly to how chunks are unloaded when 0 loaders are using a chunk, 0 loaders using a chunk which is requested for generation would cause the generation request to be aborted.
While this is somewhat cumbersome for procedurally generating terrain from a plugin, it's arguably better than the current system, and also solves this problem as an added bonus.