PiggyArchive / PiggyAuth

Safe & feature-rich auth plugin. Project has been discontinued
Apache License 2.0
33 stars 8 forks source link

Call to member function-- server crash #95

Closed nasiridrishi closed 6 years ago

nasiridrishi commented 6 years ago

DO NOT REMOVE THIS

Please make sure your issue complies with these guidelines:

General

Please fix this issue , this is has been crashing when ever I want to use PMMP version. I have tried to fix this but cant .. this error spammes when player try to join server and crashesh at some point console error:-

  2017-08-01 [17:13:33] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\player\PlayerMoveEvent' to 'PiggyAuth v3.0.0.21': Call to a member function isAuthenticated() on null on PiggyAuth\EventListener
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Error: "Call to a member function isAuthenticated() on null" (EXCEPTION) in "PiggyAuth.phar/src/PiggyAuth/EventListener" at line 330
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\player\PlayerExhaustEvent' to 'PiggyAuth v3.0.0.21': Call to a member function isAuthenticated() on null on PiggyAuth\EventListener
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Error: "Call to a member function isAuthenticated() on null" (EXCEPTION) in "PiggyAuth.phar/src/PiggyAuth/EventListener" at line 262
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\server\DataPacketReceiveEvent' to 'PiggyAuth v3.0.0.21': Call to a member function isAuthenticated() on null on PiggyAuth\EventListener
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Error: "Call to a member function isAuthenticated() on null" (EXCEPTION) in "PiggyAuth.phar/src/PiggyAuth/EventListener" at line 374
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\server\DataPacketReceiveEvent' to 'PiggyAuth v3.0.0.21': Call to a member function isAuthenticated() on null on PiggyAuth\EventListener
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Error: "Call to a member function isAuthenticated() on null" (EXCEPTION) in "PiggyAuth.phar/src/PiggyAuth/EventListener" at line 374
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\server\DataPacketReceiveEvent' to 'PiggyAuth v3.0.0.21': Call to a member function isAuthenticated() on null on PiggyAuth\EventListener
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Error: "Call to a member function isAuthenticated() on null" (EXCEPTION) in "PiggyAuth.phar/src/PiggyAuth/EventListener" at line 374
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\server\DataPacketReceiveEvent' to 'PiggyAuth v3.0.0.21': Call to a member function isAuthenticated() on null on PiggyAuth\EventListener
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Error: "Call to a member function isAuthenticated() on null" (EXCEPTION) in "PiggyAuth.phar/src/PiggyAuth/EventListener" at line 374
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\server\DataPacketReceiveEvent' to 'PiggyAuth v3.0.0.21': Call to a member function isAuthenticated() on null on PiggyAuth\EventListener
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Error: "Call to a member function isAuthenticated() on null" (EXCEPTION) in "PiggyAuth.phar/src/PiggyAuth/EventListener" at line 374
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\server\DataPacketReceiveEvent' to 'PiggyAuth v3.0.0.21': Call to a member function isAuthenticated() on null on PiggyAuth\EventListener
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Error: "Call to a member function isAuthenticated() on null" (EXCEPTION) in "PiggyAuth.phar/src/PiggyAuth/EventListener" at line 374
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\server\DataPacketReceiveEvent' to 'PiggyAuth v3.0.0.21': Call to a member function isAuthenticated() on null on PiggyAuth\EventListener
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Error: "Call to a member function isAuthenticated() on null" (EXCEPTION) in "PiggyAuth.phar/src/PiggyAuth/EventListener" at line 374
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\server\DataPacketReceiveEvent' to 'PiggyAuth v3.0.0.21': Call to a member function isAuthenticated() on null on PiggyAuth\EventListener
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Error: "Call to a member function isAuthenticated() on null" (EXCEPTION) in "PiggyAuth.phar/src/PiggyAuth/EventListener" at line 374
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\server\DataPacketReceiveEvent' to 'PiggyAuth v3.0.0.21': Call to a member function isAuthenticated() on null on PiggyAuth\EventListener
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Error: "Call to a member function isAuthenticated() on null" (EXCEPTION) in "PiggyAuth.phar/src/PiggyAuth/EventListener" at line 374
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\server\DataPacketReceiveEvent' to 'PiggyAuth v3.0.0.21': Call to a member function isAuthenticated() on null on PiggyAuth\EventListener
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Error: "Call to a member function isAuthenticated() on null" (EXCEPTION) in "PiggyAuth.phar/src/PiggyAuth/EventListener" at line 374
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\player\PlayerMoveEvent' to 'PiggyAuth v3.0.0.21': Call to a member function isAuthenticated() on null on PiggyAuth\EventListener
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Error: "Call to a member function isAuthenticated() on null" (EXCEPTION) in "PiggyAuth.phar/src/PiggyAuth/EventListener" at line 330
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\player\PlayerExhaustEvent' to 'PiggyAuth v3.0.0.21': Call to a member function isAuthenticated() on null on PiggyAuth\EventListener
2017-08-01 [17:13:33] [Server thread/CRITICAL]: Error: "Call to a member function isAuthenticated() on null" (EXCEPTION) in "PiggyAuth.phar/src/PiggyAuth/EventListener" at line 262
2017-08-01 [17:13:38] [Server thread/INFO]: jerkyface[/148.76.49.160:59745] logged in with entity id 17 at (DimmedArena, -1, 70, -39)
2017-08-01 [17:13:40] [Server thread/INFO]: EyeOfDragon2[/148.76.49.160:38760] logged in with entity id 18 at (DimmedArena, -1, 70, -39)
2017-08-01 [17:13:41] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\server\DataPacketReceiveEvent' to 'PiggyAuth v3.0.0.21': Call to a member function isAuthenticated() on null on PiggyAuth\EventListener
2017-08-01 [17:13:41] [Server thread/CRITICAL]: Error: "Call to a member function isAuthenticated() on null" (EXCEPTION) in "PiggyAuth.phar/src/PiggyAuth/EventListener" at line 374
2017-08-01 [17:13:41] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\server\DataPacketReceiveEvent' to 'PiggyAuth v3.0.0.21': Call to a member function isAuthenticated() on null on PiggyAuth\EventListener
2017-08-01 [17:13:41] [Server thread/CRITICAL]: Error: "Call to a member function isAuthenticated() on null" (EXCEPTION) in "PiggyAuth.phar/src/PiggyAuth/EventListener" at line 374
2017-08-01 [17:13:41] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\server\DataPacketReceiveEvent' to 'PiggyAuth v3.0.0.21': Call to a member function isAuthenticated() on null on PiggyAuth\EventListener
2017-08-01 [17:13:41] [Server thread/CRITICAL]: Error: "Call to a member function isAuthenticated() on null" (EXCEPTION) in "PiggyAuth.phar/src/PiggyAuth/EventListener" at line 374
2017-08-01 [17:13:41] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\server\DataPacketReceiveEvent' to 'PiggyAuth v3.0.0.21': Call to a member function isAuthenticated() on null on PiggyAuth\EventListener
2017-08-01 [17:13:41] [Server thread/CRITICAL]: Error: "Call to a member function isAuthenticated() on null" (EXCEPTION) in "PiggyAuth.phar/src/PiggyAuth/EventListener" at line 374
2017-08-01 [17:13:41] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\server\DataPacketReceiveEvent' to 'PiggyAuth v3.0.0.21': Call to a member function isAuthenticated() on null on PiggyAuth\EventListener
2017-08-01 [17:13:41] [Server thread/CRITICAL]: Error: "Call to a member function isAuthenticated() on null" (EXCEPTION) in "PiggyAuth.phar/src/PiggyAuth/EventListener" at line 374
2017-08-01 [17:13:41] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\server\DataPacketReceiveEvent' to 'PiggyAuth v3.0.0.21': Call to a member function isAuthenticated() on null on PiggyAuth\EventListener
2017-08-01 [17:13:41] [Server thread/CRITICAL]: Error: "Call to a member function isAuthenticated() on null" (EXCEPTION) in "PiggyAuth.phar/src/PiggyAuth/EventListener" at line 374
2017-08-01 [17:13:41] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\server\DataPacketReceiveEvent' to 'PiggyAuth v3.0.0.21': Call to a member function isAuthenticated() on null on PiggyAuth\EventListener
2017-08-01 [17:13:41] [Server thread/CRITICAL]: Error: "Call to a member function isAuthenticated() on null" (EXCEPTION) in "PiggyAuth.phar/src/PiggyAuth/EventListener" at line 374
2017-08-01 [17:13:41] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\server\DataPacketReceiveEvent' to 'PiggyAuth v3.0.0.21': Call to a member function isAuthenticated() on null on PiggyAuth\EventListener
2017-08-01 [17:13:41] [Server thread/CRITICAL]: Error: "Call to a member function isAuthenticated() on null" (EXCEPTION) in "PiggyAuth.phar/src/PiggyAuth/EventListener" at line 374
2017-08-01 [17:13:41] [Server thread/CRITICAL]: Error: "Call to a member function isAuthenticated() on null" (EXCEPTION) in "PiggyAuth.phar/src/PiggyAuth/Main" at line 937
2017-08-01 [17:13:41] [Server thread/EMERGENCY]: An unrecoverable error has occurred and the server has crashed. Creating a crash dump

Server Software:

PMMP #### **Version of PiggyAuth:** latest #### **Data Provider:** MySQL - [x] MySQL - [ ] SQLite - [ ] YAML - [ ] JSON #### **Steps to Reproduce the Issue**

1.

Extra Information

SalmonDE commented 6 years ago

Could you provide the content of the crashdump file?

nasiridrishi commented 6 years ago
PocketMine-MP Crash Dump Tue Aug 1 19:42:30 EDT 2017

Error: Call to a member function isAuthenticated() on null
File: PiggyAuth.phar/src/PiggyAuth/Main
Line: 937
Type: notice

THIS CRASH WAS CAUSED BY A PLUGIN
BAD PLUGIN: PiggyAuth v3.0.0.21

Code:
[928]      * @param Player $player
[929]      * @return bool
[930]      */
[931]     public function isTooManyIPOnline(Player $player)
[932]     {
[933]         $players = 0;
[934]         foreach ($this->getServer()->getOnlinePlayers() as $p) {
[935]             if ($p !== $player) {
[936]                 if ($p->getAddress() == $player->getAddress()) {
[937]                     if ($this->getSessionManager()->getSession($p)->isAuthenticated()) {
[938]                         $players++;
[939]                     }
[940]                 }
[941]             }
[942]         }
[943]         return $players > ($this->getConfig()->getNested("login.ip-limit") - 1);
[944]     }
[945] 
[946]     /**
[947]      * @param $password

Backtrace:
#0 PiggyAuth.phar/src/PiggyAuth/Main(412): PiggyAuth\Main->isTooManyIPOnline(pocketmine\Player object)
#1 PiggyAuth.phar/src/PiggyAuth/Sessions/PiggyAuthSession(464): PiggyAuth\Main->force(pocketmine\Player object, boolean 1, integer 1)
#2 PiggyAuth.phar/src/PiggyAuth/Sessions/SessionManager(51): PiggyAuth\Sessions\PiggyAuthSession->startSession(pocketmine\event\TranslationContainer object)
#3 PiggyAuth.phar/src/PiggyAuth/Tasks/MySQLTask(65): PiggyAuth\Sessions\SessionManager->PiggyAuth\Sessions\{closure}(array Array(), Volatile object, PiggyAuth\Main object)
#4 src/pocketmine/scheduler/AsyncPool(158): PiggyAuth\Tasks\MySQLTask->onCompletion(pocketmine\Server object)
#5 src/pocketmine/scheduler/ServerScheduler(341): pocketmine\scheduler\AsyncPool->collectTasks()
#6 src/pocketmine/Server(2456): pocketmine\scheduler\ServerScheduler->mainThreadHeartbeat(integer 147)
#7 src/pocketmine/Server(2221): pocketmine\Server->tick()
#8 src/pocketmine/Server(2100): pocketmine\Server->tickProcessor()
#9 src/pocketmine/Server(1682): pocketmine\Server->start()
#10 src/pocketmine/PocketMine(511): pocketmine\Server->__construct(BaseClassLoader object, pocketmine\utils\MainLogger object, string phar:///home/fac/PocketMine-MP.phar/, string /home/fac/, string /home/fac/plugins/)
#11 /home/fac/PocketMine-MP.phar(1): require_once(string phar:///home/fac/PocketMine-MP.phar/src/pocketmine/PocketMine.php)

PocketMine-MP version: 1.6.2dev #0 [Protocol 113; API 3.0.0-ALPHA7]
Git commit: 0000000000000000000000000000000000000000
uname -a: Linux PrimeFac 2.6.32-48-pve #1 SMP Fri Dec 23 10:22:54 CET 2016 x86_64
PHP Version: 7.0.3
Zend version: 3.0.0
OS : Linux, linux
nasiridrishi commented 6 years ago

please help fix this and email problem with pmmp where it doesnt respond anything when I enter email while registration etc. piggyauth will be perfect after this!

Aericio commented 6 years ago

piggyauth will be perfect after this!

To that, I will say PiggyAuth has been incredibly buggy since 0.17.0 and still is.

SalmonDE commented 6 years ago

@DaPigGuy I think it could be right to make MySQL::getPlayer() synchronously. What are your thoughts?

DaPigGuy commented 6 years ago

Yeah :/

SalmonDE commented 6 years ago

Actually, how about creating a temporary Session for the player which will always return false for isAuthenticated()? That way we won't block the main thread and can solve this issue.

SalmonDE commented 6 years ago

I consider this fixed but it still needs testing. At the moment I'm not completly sure how the plugin will behave if the player has a temporary session.

nasiridrishi commented 6 years ago

I will test in my servers and report!

nasiridrishi commented 6 years ago

still same! crashing server on "is too many players online" ! whats this???

THIS CRASH WAS CAUSED BY A PLUGIN
BAD PLUGIN: PiggyAuth v3.0.0.22

Code:
[928]      * @param Player $player
[929]      * @return bool
[930]      */
[931]     public function isTooManyIPOnline(Player $player)
[932]     {
[933]         $players = 0;
[934]         foreach ($this->getServer()->getOnlinePlayers() as $p) {
[935]             if ($p !== $player) {
[936]                 if ($p->getAddress() == $player->getAddress()) {
[937]                     if ($this->getSessionManager()->getSession($p)->isAuthenticated()) {
[938]                         $players++;
[939]                     }
[940]                 }
[941]             }
[942]         }
[943]         return $players > ($this->getConfig()->getNested("login.ip-limit") - 1);
[944]     }
[945] 
[946]     /**
[947]      * @param $password

Backtrace:
#0 PiggyAuth.phar/src/PiggyAuth/Main(412): PiggyAuth\Main->isTooManyIPOnline(pocketmine\Player object)
#1 PiggyAuth.phar/src/PiggyAuth/Sessions/PiggyAuthSession(464): PiggyAuth\Main->force(pocketmine\Player object, boolean 1, integer 1)
#2 PiggyAuth.phar/src/PiggyAuth/Sessions/SessionManager(51): PiggyAuth\Sessions\PiggyAuthSession->startSession(pocketmine\event\TranslationContainer object)
#3 PiggyAuth.phar/src/PiggyAuth/Tasks/MySQLTask(65): PiggyAuth\Sessions\SessionManager->PiggyAuth\Sessions\{closure}(array Array(), Volatile object, PiggyAuth\Main object)
#4 src/pocketmine/scheduler/AsyncPool(158): PiggyAuth\Tasks\MySQLTask->onCompletion(pocketmine\Server object)
#5 src/pocketmine/scheduler/ServerScheduler(341): pocketmine\scheduler\AsyncPool->collectTasks()
#6 src/pocketmine/Server(2456): pocketmine\scheduler\ServerScheduler->mainThreadHeartbeat(integer 399)
#7 src/pocketmine/Server(2221): pocketmine\Server->tick()
#8 src/pocketmine/Server(2100): pocketmine\Server->tickProcessor()
#9 src/pocketmine/Server(1682): pocketmine\Server->start()
#10 src/pocketmine/PocketMine(511): pocketmine\Server->__construct(BaseClassLoader object, pocketmine\utils\MainLogger object, string phar:///home/fac/PocketMine-MP.phar/, string /home/fac/, string /home/fac/plugins/)
#11 /home/fac/PocketMine-MP.phar(1): require_once(string phar:///home/fac/PocketMine-MP.phar/src/pocketmine/PocketMine.php)

PocketMine-MP version: 1.6.2dev #0 [Protocol 113; API 3.0.0-ALPHA7]
Git commit: 0000000000000000000000000000000000000000
uname -a: Linux optimusprime338 2.6.32-48-pve #1 SMP Fri Dec 23 10:22:54 CET 2016 x86_64
PHP Version: 7.0.3
Zend version: 3.0.0
OS : Linux, linux
SalmonDE commented 6 years ago

Thanks for testing so quickly! :) Could you tell me when this crash happened? (Server start, player join ...). Also, is there a message about the error in the console?

nasiridrishi commented 6 years ago

when players join! after restart

nasiridrishi commented 6 years ago

@DaPigGuy I am sorry but one last request! can you fix email thing,, email thing work while registration in genesis but not in pmmp! why?

nasiridrishi commented 6 years ago

it(email) doesnt work in yml and mysql both and in genesis it works with both and in genesis it got no problems and it runs at it best with no errors!