Pocketmine-mp: InvalidArgumentException: "Value -1846369469471916032 is too large!" (EXCEPTION) in "/src/pocketmine/nbt/tag/IntTag" at line 68

Created on 9 Jun 2017  Â·  6Comments  Â·  Source: pmmp/PocketMine-MP

Issue description



Steps to reproduce the issue

  1. Users sign in and receive an error CID is too big.
  2. ...

OS and versions

  • PocketMine-MP: This server is running PocketMine-MP 1.6.2dev 「Unleashed」 implementing API version 3.0.0-ALPHA5 for Minecraft: PE v1.1.0.55 (protocol version 113) Commit a302b49
  • PHP: 7.0.12
  • Server OS: CentOS 6.5 64Bit

Plugins

2017-06-08 [21:35:30] [Server thread/INFO]: Plugins (9): DevTools v1.11.1, MCPEBuildBattle v2.0.0, SecretSauce v1.2, FactionsPro v1.9, TopVoter v1.7, SAMMY v2, WorldProtect v2.2.0, RealTime v2.1.1, MyPlot v1.1.3

Crashdump, backtrace or other files

  • ...
Core Fixed

Most helpful comment

The problem seems to be here.

mt_rand(PHP_INT_MIN, PHP_INT_MAX) is being used to generate XpSeed, but in IntTag, the check uses (-2^32, 2^32) as the bounds (the int bounds for 32-bit systems). PHP_INT_MIN and PHP_INT_MAX would be larger on 64-bit systems, hence the error. Since an IntTag was used and not a LongTag, XpSeed should (probably) be generated with the 32-bit integer bounds.

All 6 comments

It for sure only happened in the commits with the last two days, The number being returned is the player CID. We are running x64. As xxFlare said, it's when users join but is random.

Another one looking at console now:
Enabled debug now, so may have something more soon.

I thought it was only happening on new profiles. Maybe not.

2017-06-08 [22:08:17] [Server thread/NOTICE]: Player data not found for "panda", crtoo leating new profile
2017-06-08 [22:08:34] [Server thread/DEBUG]: Packet pocketmine\network\mcpe\protocol\BatchPacket 0xfe78da63e1606160000000450011
2017-06-08 [22:08:34] [Server thread/CRITICAL]: InvalidArgumentException: "Value -7894446079582666752 is too large!" (EXCEPTION) in "/src/pocketmine/nbt/tag/IntTag" at line 68
2017-06-08 [22:08:34] [Server thread/DEBUG]: #0 /src/pocketmine/nbt/tag/NamedTag(38): pocketmine\nbt\tag\IntTag->setValue(integer -7894446079582666752)
2017-06-08 [22:08:34] [Server thread/DEBUG]: #1 /src/pocketmine/nbt/tag/IntTag(37): pocketmine\nbt\tag\NamedTag->__construct(string XpSeed, integer -7894446079582666752)
2017-06-08 [22:08:34] [Server thread/DEBUG]: #2 /src/pocketmine/entity/Human(360): pocketmine\nbt\tag\IntTag->__construct(string XpSeed, integer -7894446079582666752)
2017-06-08 [22:08:34] [Server thread/DEBUG]: #3 /src/pocketmine/entity/Entity(394): pocketmine\entity\Human->initEntity(boolean)
2017-06-08 [22:08:34] [Server thread/DEBUG]: #4 /src/pocketmine/entity/Human(79): pocketmine\entity\Entity->__construct(pocketmine\level\Level object, pocketmine\nbt\tag\CompoundTag object)
2017-06-08 [22:08:34] [Server thread/DEBUG]: #5 /src/pocketmine/Player(1846): pocketmine\entity\Human->__construct(pocketmine\level\Level object, pocketmine\nbt\tag\CompoundTag object)
2017-06-08 [22:08:34] [Server thread/DEBUG]: #6 /src/pocketmine/Player(2049): pocketmine\Player->completeLoginSequence(boolean)

The problem seems to be here.

mt_rand(PHP_INT_MIN, PHP_INT_MAX) is being used to generate XpSeed, but in IntTag, the check uses (-2^32, 2^32) as the bounds (the int bounds for 32-bit systems). PHP_INT_MIN and PHP_INT_MAX would be larger on 64-bit systems, hence the error. Since an IntTag was used and not a LongTag, XpSeed should (probably) be generated with the 32-bit integer bounds.

Nowhere in the error does it mention CID.

The Level RNG ought to be used for this... I don't know why Level doesn't have an RNG to be honest.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Frago9876543210 picture Frago9876543210  Â·  50Comments

MisteFr picture MisteFr  Â·  18Comments

L3ice picture L3ice  Â·  21Comments

dktapps picture dktapps  Â·  19Comments

MisteFr picture MisteFr  Â·  29Comments