Closed vykius closed 5 years ago
setupAuthClasses
should barely graze the CPU - you're likely having some configuration issue at a deeper layer. Does the page load hang at all? Anything in the log files?
If I comment this in AuthenticationBase class isLoggedIn method, works fine
I using ajax
if ($userID = session('logged_in')) {
// Store our current user object
$this->user = $this->userModel->find($userID);
return true;
}
Sometime I get this error:
CRITICAL - 2019-05-21 08:21:01 --> session_start(): Failed to decode session object. Session has been destroyed
#0 [internal function]: CodeIgniter\Debug\Exceptions->errorHandler(2, 'session_start()...', '/home/inotacho/...', 984, Array)
#1 /home/inotacho/system/Session/Session.php(984): session_start()
#2 /home/inotacho/system/Session/Session.php(237): CodeIgniter\Session\Session->startSession()
#3 /home/inotacho/system/Config/Services.php(721): CodeIgniter\Session\Session->start()
#4 /home/inotacho/system/Config/BaseService.php(119): CodeIgniter\Config\Services::session(Object(Config\App), false)
#5 /home/inotacho/system/Config/Services.php(702): CodeIgniter\Config\BaseService::getSharedInstance('session', NULL)
#6 /home/inotacho/system/Common.php(341): CodeIgniter\Config\Services::session()
#7 /home/inotacho/app/ThirdParty/Myth/Auth/Authentication/AuthenticationBase.php(134): session('logged_in')
#8 /home/inotacho/app/ThirdParty/Myth/Auth/Authentication/LocalAuthenticator.php(41): Myth\Auth\Authentication\AuthenticationBase->isLoggedIn()
#9 /home/inotacho/app/ThirdParty/Myth/Auth/AuthTrait.php(170): Myth\Auth\Authentication\LocalAuthenticator->check()
#10 /home/inotacho/app/ThirdParty/Drivers/Controllers/DriverController.php(19): Drivers\Controllers\DriverController->setupAuthClasses()
#11 /home/inotacho/system/CodeIgniter.php(813): Drivers\Controllers\DriverController->__construct()
#12 /home/inotacho/system/CodeIgniter.php(330): CodeIgniter\CodeIgniter->createController()
#13 /home/inotacho/system/CodeIgniter.php(245): CodeIgniter\CodeIgniter->handleRequest(NULL, Object(Config\Cache), false)
#14 /home/inotacho/public_html/index.php(47): CodeIgniter\CodeIgniter->run()
#15 {main}
That's some helpful info. It looks like you're definitely having issues with the framework or even your underlying PHP configuration. That message might be related to storing too large of a serialized array in session data (e.g. https://stackoverflow.com/questions/34944892/session-destroyed-out-of-nowhere-in-php).
Would you mind sharing what session driver you are using? E.g. $sessionDriver
from "app/Config/App.php". Also are you storing other data in your session, or just the Auth data at this point?
Yes, I using only Auth data in session.
public $sessionDriver = 'CodeIgniter\Session\Handlers\FileHandler';
Couldn't it be related to ajax request?
I open page, and try to get data from same server with ajax, and like I say before 4-5 times I get data and after CPU up to 100%
THIS IS EXAMPLE FROM AJAX
public function __construct() {
$this->setupAuthClasses();
}
public function get() {
if(!$this->authenticate->check()) {
$driverManager = new DriverManager();
$drivers = $driverManager->get()->toArray()->all();
$response['status'] = true;
$response['response'] = $drivers;
return $this->response->setContentType('application/json')
->setStatusCode(200)
->setBody(json_encode($response));
}
}
I try to remove ajax request and I think CPU works fine now
Cannot replicate.
Hi,
I try use this Auth package with cPanel and I noticed when I refresh 4-7 fast page CPU up to 100% in cPanel
And this happening when I try setup Auth Classes
Example:
And I am thinking in this place
session('logged_in')