Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading chunk with invalid item causes a crash #32

Closed
PrimusLV opened this issue Oct 17, 2016 · 4 comments
Closed

Loading chunk with invalid item causes a crash #32

PrimusLV opened this issue Oct 17, 2016 · 4 comments
Labels
Category: Core Related to internal functionality Resolution: Fixed

Comments

@PrimusLV
Copy link

PrimusLV commented Oct 17, 2016

Issue description

For some reason sometimes when porting worlds from PC version or maybe converting format types. the item entities can be written on chunk nbt file wrong and cause crash when loading them.

Steps to reproduce the issue

I Don't know and don't want to.

OS and versions

  • PocketMine-MP: Starting from 1.4 and up

Crashdump, backtrace or other files

I added some debug messages in Item.php inside initEntity() and this is the output when invalid entity tries to get loaded.

tried to spawn invalid item entity (minecraft:wooden_axe:0:1) at Position(level=mines,x=-226.93924904777,y=74.661162516132,z=113.17553093388)
tried to spawn invalid item entity (minecraft:glass_pane:0:1) at Position(level=mines,x=-227.12765333584,y=74.908027488115,z=113.33313738153)

I added temporary workaround for this

if(!$this->namedtag->Item->id instanceof IntTag) {
    $this->level->removeEntity($this);
    return;
}

But this code above doesn't remove the entity record from nbt file.

This is the full error from console.

[22:56:03] [Server thread/CRITICAL]: TypeError: "Argument 1 passed to pocketmine\item\Item::get() must be of the type integer, string given, called in /home/primus/DevField/src/pocketmine/nbt/NBT.php on line 110" (EXCEPTION) in "/src/pocketmine/item/Item" at line 283
[22:56:03] [Server thread/EMERGENCY]: An unrecoverable error has occurred and the server has crashed. Creating a crash dump
[22:56:03] [Server thread/EMERGENCY]: Please upload the "/home/primus/DevField/CrashDump_Mon_Oct_17-22.56.03-EEST_2016.log" file to the Crash Archive and submit the link to the Bug Reporting page. Give as much info as you can.

And this is the dump string of that Item entity

["id"]=>
  object(pocketmine\nbt\tag\StringTag)#11871 (2) {
    ["__name":protected]=>
    string(2) "id"
    ["value":protected]=>
    string(17) "minecraft:feather"
  }
  ["Count"]=>
  object(pocketmine\nbt\tag\ByteTag)#11872 (2) {
    ["__name":protected]=>
    string(5) "Count"
    ["value":protected]=>
    int(1)
  }
  ["Damage"]=>
  object(pocketmine\nbt\tag\ShortTag)#11873 (2) {
    ["__name":protected]=>
    string(6) "Damage"
    ["value":protected]=>
    int(0)
  }

@dktapps dktapps added the Category: Core Related to internal functionality label Oct 17, 2016
@dktapps
Copy link
Member

dktapps commented Oct 17, 2016

Is that a client or server crash?

@PrimusLV
Copy link
Author

Server

@dktapps dktapps added the Status: Debugged Cause of the bug has been found, but not fixed label Oct 17, 2016
dktapps added a commit that referenced this issue Oct 17, 2016
@dktapps
Copy link
Member

dktapps commented Oct 17, 2016

Can I ask what version of MC PC this world was generated with?

@PrimusLV
Copy link
Author

I got this world from my friend so I don't know. However I'll try to find out but for now, Great job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Core Related to internal functionality Resolution: Fixed
Projects
None yet
Development

No branches or pull requests

2 participants