Session flock PHP timeout |
Greetings guys,
I'm using codeigniter 4 for most of my projects and I am facing an Issue, sometimes, with the session data with the default FileHandler of codeigniter 4. In codeigniter log i have this error sometimes: CRITICAL - 2024-07-17 11:08:37 --> Maximum execution time of 240 seconds exceeded in SYSTEMPATH\Session\Handlers\FileHandler.php on line 134. 1 [internal function]: CodeIgniter\Debug\Exceptions->shutdownHandler() In apache log I have those: [php:error] [pid 7560:tid 2020] [client ::1:51108] PHP Fatal error: Maximum execution time of 240 seconds exceeded in C:\\xampp\\htdocs\\Riepilogo_lavorazioni4\\vendor\\codeigniter4\\framework\\system\\Session\\Handlers\\FileHandler.php on line 134, referer: https://riepilogo_lavorazioni4.imbalplas...avorazioni [php:error] [pid 7560:tid 2020] [client ::1:51108] PHP Fatal error: Uncaught ErrorException: Unknown: Cannot call session save handler in a recursive manner in Unknown:0\nStack trace:\n#0 [internal function]: CodeIgniter\\Debug\\Exceptions->errorHandler(2, 'Unknown: Cannot...', 'Unknown', 0)\n#1 {main}\n thrown in Unknown on line 0, referer: https://riepilogo_lavorazioni4.imbalplas...avorazioni I've checked in the FileHandler and on the line 134 there is the flock: PHP Code: if (flock($this->fileHandle, LOCK_EX) === false) { I have the session preloaded in this way in the base controller: PHP Code: protected $session; And in most of my methods i check the user login in this way: PHP Code: public function getLista_lavorazioni($macchinario = NULL) PHP VERSION IS: 8.1.12 Codeigniter version is: '4.3.5' It seems codeigniter try to access a session file that is locked and go in timeout. I have some ajax and long processes in some points and i check there too if the user is logged in or not. Maybe the problem is it? Can you help me solve this? Thanks in advance (07-19-2024, 02:15 AM)kenjis Wrote: See https://codeigniter.com/user_guide/libra...oncurrency So you are suggesting that i have to manually close the session to solve this. But i have codeigniter 4.3.5 and session close is available after 4.4.0. I can't upgrade it because there are folders inside the projects shared on the network and it don't let me rename it (to _old for example) and I cannot change the folder name because of paths and the a dns that user https. Is there another way to close it in older versions? UPDATE: I've added it manually in session methods cause it is a simple session_write_close() as I see. I will try to use it and let you know if i'll still have the issue. Thanks |
Welcome Guest, Not a member yet? Register Sign In |