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

Undefined array key - by using CPlot PlugIN #5713

Closed
krake79 opened this issue Apr 19, 2023 · 2 comments
Closed

Undefined array key - by using CPlot PlugIN #5713

krake79 opened this issue Apr 19, 2023 · 2 comments
Labels
Category: Core Related to internal functionality Resolution: Fixed

Comments

@krake79
Copy link

krake79 commented Apr 19, 2023

Issue description

I'm running CPlot_dev142 and the current PM4.19.2.
If I now want to add a claim, I get an error message:

ErrorException: "Undefined array key 5" (EXCEPTION) in "pmsrc/src/event/HandlerList" at line 105

Steps to reproduce the issue

Command: /P claim

OS and versions

  • PocketMine-MP: 4.19.2
  • PHP: 8.0
  • Server OS: W10Pro 64Bit
  • Game version: iOS + Win10

Plugins

  • If you remove all plugins, does the issue still occur?
  • Only some Commands of the plugin

Crashdump, backtrace or other files

[Server thread/CRITICAL]: ErrorException: "Undefined array key 5" (EXCEPTION) in "pmsrc/src/event/HandlerList" at line 105
--- Stack trace ---
  #0 pmsrc/src/event/HandlerList(105): pocketmine\errorhandler\ErrorToExceptionHandler::handle(int 2, string[21] Undefined array key 5, string[104] phar://C:/PM/PocketMine-MP.phar/s, int 105)
  #1 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/ColinHDev/libAsyncEvent/AsyncEvent(67): pocketmine\event\HandlerList->getListenersByPriority(int 5)
  #2 (): ColinHDev\CPlot\libs\ColinHDev\libAsyncEvent\AsyncEvent->getEventHandlers()
  #3 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/ColinHDev/libAsyncEvent/AsyncEvent(44): Generator->valid()
  #4 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/ColinHDev/libAsyncEvent/AsyncEvent(27): ColinHDev\CPlot\libs\ColinHDev\libAsyncEvent\AsyncEvent->tryToResume()
  #5 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/event/PlotClaimAsyncEvent(38): ColinHDev\CPlot\libs\ColinHDev\libAsyncEvent\AsyncEvent->call()
  #6 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/SOFe/AwaitGenerator/Await(212): ColinHDev\CPlot\event\PlotClaimAsyncEvent::ColinHDev\CPlot\event\{closure}(object Closure#240483, object Closure#217998)
  #7 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/event/PlotClaimAsyncEvent(42): ColinHDev\CPlot\libs\SOFe\AwaitGenerator\Await::promise(object Closure#218083)
  #8 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/commands/subcommands/ClaimSubcommand(93): ColinHDev\CPlot\event\PlotClaimAsyncEvent::create(object ColinHDev\CPlot\plots\Plot#186405, object pocketmine\player\Player#129736)
  #9 (): ColinHDev\CPlot\commands\subcommands\ClaimSubcommand->execute(object pocketmine\player\Player#129736, array[0])
  #10 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/SOFe/AwaitGenerator/Await(286): Generator->send(object Closure#217998)
  #11 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/SOFe/AwaitGenerator/Await(242): ColinHDev\CPlot\libs\SOFe\AwaitGenerator\Await->ColinHDev\CPlot\libs\SOFe\AwaitGenerator\{closure}()
  #12 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/SOFe/AwaitGenerator/Await(227): ColinHDev\CPlot\libs\SOFe\AwaitGenerator\Await->wakeup(object Closure#240469)
  #13 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/SOFe/AwaitGenerator/Await(462): ColinHDev\CPlot\libs\SOFe\AwaitGenerator\Await->wakeupFlat(object Closure#240469)
  #14 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/SOFe/AwaitGenerator/AwaitChild(52): ColinHDev\CPlot\libs\SOFe\AwaitGenerator\Await->recheckPromiseQueue(object ColinHDev\CPlot\libs\SOFe\AwaitGenerator\AwaitChild#218001)
  #15 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/utils/promise/PromiseResolver(37): ColinHDev\CPlot\libs\SOFe\AwaitGenerator\AwaitChild->resolve(array[1])
  #16 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/utils/promise/PromiseResolver(53): ColinHDev\CPlot\utils\promise\PromiseResolver->resolve(array[1])
  #17 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/CPlotAPI(421): ColinHDev\CPlot\utils\promise\PromiseResolver->resolveSilent(array[1])
  #18 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/SOFe/AwaitGenerator/Await(480): ColinHDev\CPlot\CPlotAPI::ColinHDev\CPlot\{closure}(array[1])
  #19 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/SOFe/AwaitGenerator/Await(250): ColinHDev\CPlot\libs\SOFe\AwaitGenerator\Await->resolve(array[1])
  #20 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/SOFe/AwaitGenerator/Await(227): ColinHDev\CPlot\libs\SOFe\AwaitGenerator\Await->wakeup(object Closure#240474)
  #21 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/SOFe/AwaitGenerator/Await(462): ColinHDev\CPlot\libs\SOFe\AwaitGenerator\Await->wakeupFlat(object Closure#240474)
  #22 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/SOFe/AwaitGenerator/AwaitChild(52): ColinHDev\CPlot\libs\SOFe\AwaitGenerator\Await->recheckPromiseQueue(object ColinHDev\CPlot\libs\SOFe\AwaitGenerator\AwaitChild#234463)
  #23 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/SOFe/AwaitGenerator/Await(480): ColinHDev\CPlot\libs\SOFe\AwaitGenerator\AwaitChild->resolve(object ColinHDev\CPlot\plots\Plot#234452)
  #24 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/SOFe/AwaitGenerator/Await(250): ColinHDev\CPlot\libs\SOFe\AwaitGenerator\Await->resolve(object ColinHDev\CPlot\plots\Plot#234452)
  #25 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/SOFe/AwaitGenerator/Await(227): ColinHDev\CPlot\libs\SOFe\AwaitGenerator\Await->wakeup(object Closure#240465)
  #26 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/SOFe/AwaitGenerator/Await(462): ColinHDev\CPlot\libs\SOFe\AwaitGenerator\Await->wakeupFlat(object Closure#240465)
  #27 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/SOFe/AwaitGenerator/AwaitChild(52): ColinHDev\CPlot\libs\SOFe\AwaitGenerator\Await->recheckPromiseQueue(object ColinHDev\CPlot\libs\SOFe\AwaitGenerator\AwaitChild#240161)
  #28 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/poggit/libasynql/base/DataConnectorImpl(197): ColinHDev\CPlot\libs\SOFe\AwaitGenerator\AwaitChild->resolve(array[0])
  #29 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/poggit/libasynql/base/DataConnectorImpl(174): ColinHDev\CPlot\libs\poggit\libasynql\base\DataConnectorImpl::ColinHDev\CPlot\libs\poggit\libasynql\base\{closure}(array[0], array[0])
  #30 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/poggit/libasynql/base/DataConnectorImpl(181): ColinHDev\CPlot\libs\poggit\libasynql\base\DataConnectorImpl::ColinHDev\CPlot\libs\poggit\libasynql\base\{closure}(object ColinHDev\CPlot\libs\poggit\libasynql\result\SqlSelectResult#240120)
  #31 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/poggit/libasynql/base/DataConnectorImpl(239): ColinHDev\CPlot\libs\poggit\libasynql\base\DataConnectorImpl::ColinHDev\CPlot\libs\poggit\libasynql\base\{closure}(array[1])
  #32 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/poggit/libasynql/base/SqlThreadPool(112): ColinHDev\CPlot\libs\poggit\libasynql\base\DataConnectorImpl->ColinHDev\CPlot\libs\poggit\libasynql\base\{closure}(array[1])
  #33 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/poggit/libasynql/base/DataConnectorImpl(322): ColinHDev\CPlot\libs\poggit\libasynql\base\SqlThreadPool->readResults(array[13])
  #34 plugins/CPlot_dev-142.phar/src/ColinHDev/CPlot/libs/poggit/libasynql/base/SqlThreadPool(65): ColinHDev\CPlot\libs\poggit\libasynql\base\DataConnectorImpl->checkResults()
  #35 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(123): ColinHDev\CPlot\libs\poggit\libasynql\base\SqlThreadPool->ColinHDev\CPlot\libs\poggit\libasynql\base\{closure}()
  #36 pmsrc/src/TimeTrackingSleeperHandler(58): pocketmine\snooze\SleeperHandler->processNotifications()
  #37 pmsrc/vendor/pocketmine/snooze/src/SleeperHandler(82): pocketmine\TimeTrackingSleeperHandler->processNotifications()
  #38 pmsrc/src/Server(1681): pocketmine\snooze\SleeperHandler->sleepUntil(float 1681928384.7946)
  #39 pmsrc/src/Server(1061): pocketmine\Server->tickProcessor()
  #40 pmsrc/src/PocketMine(339): pocketmine\Server->__construct(object BaseClassLoader#5, object pocketmine\utils\MainLogger#2, string[53] C:\Users\Gamesucht\Desktop\PocketMine Live bei Crash\, string[61] C:\Users\Gamesucht\Desktop\PocketMine Live bei Crash\plugins\)
  #41 pmsrc/src/PocketMine(362): pocketmine\server()
  #42 pmsrc(11): require(string[97] phar://C:/PM/PocketMine Live bei Crash/PocketMine-MP.phar/s)
--- End of exception information ---
@krake79 krake79 changed the title Undefined array key - by Usind CPlot PlugIN Undefined array key - by using CPlot PlugIN Apr 19, 2023
@jasonw4331
Copy link
Contributor

The problem is HandlerList::getListenersByPriority() triggering a crash on a valid priority number.
Reproducing code:

        $handlerList = HandlerListManager::global()->getListFor(get_class($this));
        foreach (EventPriority::ALL as $priority) {
            $currentList = $handlerList;
            while ($currentList !== null) {
                foreach ($currentList->getListenersByPriority($priority) as $registration) {
                    yield $registration;
                }
                $currentList = $currentList->getParent();
            }
        }

@dktapps
Copy link
Member

dktapps commented Apr 19, 2023

@SOF3 Maybe explore whether that code can be simplified by getListenerList() in 4.19?

@dktapps dktapps added Category: Core Related to internal functionality Status: Debugged Cause of the bug has been found, but not fixed labels Apr 20, 2023
@dktapps dktapps added Resolution: Fixed and removed Status: Debugged Cause of the bug has been found, but not fixed labels Apr 21, 2023
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

3 participants