{"action":"created","issue":{"url":"https://api.github.com/repos/pmmp/PocketMine-MP/issues/1527","repository_url":"https://api.github.com/repos/pmmp/PocketMine-MP","labels_url":"https://api.github.com/repos/pmmp/PocketMine-MP/issues/1527/labels{/name}","comments_url":"https://api.github.com/repos/pmmp/PocketMine-MP/issues/1527/comments","events_url":"https://api.github.com/repos/pmmp/PocketMine-MP/issues/1527/events","html_url":"https://github.com/pmmp/PocketMine-MP/issues/1527","id":272130282,"number":1527,"title":"checkTickUpdates on unloaded levels causes the server to crash","user":{"login":"thebigsmileXD","id":8733998,"avatar_url":"https://avatars3.githubusercontent.com/u/8733998?v=4","gravatar_id":"","url":"https://api.github.com/users/thebigsmileXD","html_url":"https://github.com/thebigsmileXD","followers_url":"https://api.github.com/users/thebigsmileXD/followers","following_url":"https://api.github.com/users/thebigsmileXD/following{/other_user}","gists_url":"https://api.github.com/users/thebigsmileXD/gists{/gist_id}","starred_url":"https://api.github.com/users/thebigsmileXD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thebigsmileXD/subscriptions","organizations_url":"https://api.github.com/users/thebigsmileXD/orgs","repos_url":"https://api.github.com/users/thebigsmileXD/repos","events_url":"https://api.github.com/users/thebigsmileXD/events{/privacy}","received_events_url":"https://api.github.com/users/thebigsmileXD/received_events","type":"User","site_admin":false},"labels":[{"id":454785701,"url":"https://api.github.com/repos/pmmp/PocketMine-MP/labels/Category:%20Core","name":"Category: Core","color":"00aa55","default":false},{"id":454782351,"url":"https://api.github.com/repos/pmmp/PocketMine-MP/labels/Category:%20Plugin%20API","name":"Category: Plugin API","color":"00aa55","default":false},{"id":454787133,"url":"https://api.github.com/repos/pmmp/PocketMine-MP/labels/Status:%20Debugged","name":"Status: Debugged","color":"c5def5","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2017-11-08T09:30:36Z","updated_at":"2017-12-04T09:59:28Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"### Issue description\r\n<!---\r\nTHIS ISSUE TRACKER IS FOR BUG REPORTING, NOT FOR HELP & SUPPORT. If you need help, use the links below. \r\n- http://pmmp.readthedocs.io/en/rtfd/ - Documentation\r\n- https://forums.pmmp.io - PMMP Forums\r\n\r\nAny issues requesting updates to new versions of MCPE will be treated as spam.\r\nPlease do not create issues for missing/un-implemented gameplay features - they will be closed.\r\n-->\r\n\r\n<!--- Write a short description about the issue -->\r\nI am unloading worlds for getting reset after a round in minigames.\r\nI've some day suddenly got crashes, and debugged the full plugin.\r\n\r\nThe way i am unloading the level:\r\n```\r\n\t\t$server = Server::getInstance();\r\n\t\tif ($server->isLevelLoaded($levelname)){\r\n\t\t\t$server->unloadLevel($server->getLevelByName($levelname));\r\n\t\t\tServer::getInstance()->getLogger()->notice('Level ' . $levelname . ' successfully unloaded!');\r\n//imagine some copy_r magic here to restore the old world\r\n\t\t\t\t\t\t\tif (!Server::getInstance()->isLevelLoaded($levelname))\r\n\t\t\t\t\t\t\t\tServer::getInstance()->getLogger()->notice('Level ' . $levelname . (Server::getInstance()->loadLevel($levelname) ? ' successfully' : ' NOT') . ' reloaded!');\r\n```\r\n\r\nFor some reason, while all that, `Server::checkTickUpdates($currentTick, $tickTime)` is called\r\n```\r\n\t\tforeach($this->getLevels() as $level){\r\n```\r\n\r\nShould not even contain the unloaded level anymore - but it is passed as null\r\nAfter that, the server crashes on \r\n```\r\n\t\t\t\t\t\t#$this->getLogger()->debug(\"Raising level \\\"{$level->getName()}\\\" tick rate to {$level->getTickRate()} ticks\");\r\n```\r\nin that function - `null->getName()` or `Level->getProvider()->getName()` where the provider is null\r\n\r\nSo either something is wrong with the unloadLevel function, or with getLevels.\r\n\r\n<!--- If you are reporting a regression or unexpected behaviour, please include the below information: -->\r\n- Expected result: What were you expecting to happen?\r\nThe level being unloaded and not checked for ticks anymore\r\n- Actual result: What actually happened?\r\nServer crashes due to debug based on null\r\n\r\n### Steps to reproduce the issue\r\n<!--- help us find the problem by adding steps to reproduce the issue -->\r\n1. execute the above code on a level which is not the default level\r\n2. see the server beautifully crash\r\n\r\n### OS and versions\r\n<!--- use the 'version' command in PocketMine-MP\r\n\r\nNOTE: LATEST is not a valid version. PocketMine-MP version should include Jenkins build number and/or git commit hash.\r\n\r\nNO support whatsoever will be provided for third-party modified variants of PocketMine-MP. Issues relating to third-party modifications will be closed as spam.\r\n\r\nNote that 32-bit platforms are no longer supported by PocketMine-MP and issues concerning 32-bit platforms will be closed.\r\n-->\r\n* PocketMine-MP: https://github.com/pmmp/PocketMine-MP/commit/733e61f8150287595ee567770b19b5a7897c4331\r\n* PHP: 7.2 RC 3\r\n\r\n### Plugins\r\n- Test on a clean server without plugins: is the issue reproducible without any plugins loaded?\r\nNo - You need a plugin that executes the code.\r\n\r\nIf the issue is **not** reproducible without plugins:\r\n- Have you asked for help on our forums before creating an issue?\r\nWhy should i, to get messages by little kids \"have you tried xxx\" or \"i can not get that\"?\r\n- Can you provide sample, *minimal* reproducing code for the issue? If so, paste it in the bottom section\r\nSee above actually\r\n- Paste your list of plugins here (use the 'plugins' command in PocketMine-MP)\r\n[10:28:29] [Server thread/INFO]: Plugins (26): DevTools v1.12.1, ManyWorlds v2.1.0, PurePerms v1.4.1-dev1, DEVirion v1.2.2, gamereward v1.0.0, LobbyManager v0.0.1, MagicWE v0.3.1, TNTRun v0.1.0\r\n\r\nWhereas TNTRun is the plugin that contains the above code which crashes the server.\r\n\r\n### Crashdump, backtrace or other files\r\n- Do not paste crashdumps into an issue - please use our Crash Archive at https://crash.pmmp.io for submitting crash reports to not spam the issue tracker. Add links to your reports in the Crash Archive here.\r\n- Please use gist or anything else to add other files and add links here \r\n\r\n* ...\r\n"},"comment":{"url":"https://api.github.com/repos/pmmp/PocketMine-MP/issues/comments/348914344","html_url":"https://github.com/pmmp/PocketMine-MP/issues/1527#issuecomment-348914344","issue_url":"https://api.github.com/repos/pmmp/PocketMine-MP/issues/1527","id":348914344,"user":{"login":"dktapps","id":14214667,"avatar_url":"https://avatars2.githubusercontent.com/u/14214667?v=4","gravatar_id":"","url":"https://api.github.com/users/dktapps","html_url":"https://github.com/dktapps","followers_url":"https://api.github.com/users/dktapps/followers","following_url":"https://api.github.com/users/dktapps/following{/other_user}","gists_url":"https://api.github.com/users/dktapps/gists{/gist_id}","starred_url":"https://api.github.com/users/dktapps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dktapps/subscriptions","organizations_url":"https://api.github.com/users/dktapps/orgs","repos_url":"https://api.github.com/users/dktapps/repos","events_url":"https://api.github.com/users/dktapps/events{/privacy}","received_events_url":"https://api.github.com/users/dktapps/received_events","type":"User","site_admin":false},"created_at":"2017-12-04T09:59:28Z","updated_at":"2017-12-04T09:59:28Z","author_association":"OWNER","body":"With the referenced commit this should no longer crash the server, although it will still trigger an exception. The server crash was occurring because it was crashing trying to log an exception."}}
{"actor":{"display_login":"dktapps"}}