Welcome Guest, Not a member yet? Register   Sign In
Impossible to load database (Session file Error) and too many connexions with mysqli driver with CI 3.0
#3

[eluser]ivantcholakov[/eluser]
For
‘pconnect’ => TRUE ,

I think I know what causes the problem. Compare the sources of the file system/core/CodeIgniter.php. For CI 2.1.4 at the end of this file there is the following fragment:

Code:
/*
* ------------------------------------------------------
*  Close the DB connection if one exists
* ------------------------------------------------------
*/
if (class_exists('CI_DB') AND isset($CI->db))
{
  $CI->db->close();
}

For CI 3.0-dev this fragment is missing. This is it.

For persistent connections it is important the connection to be closed. The native MySQL connection in this case does not actually close, it gets "released" and available to be used again.
When $CI->db->close(); is not executed, the current persistent connection does not get "released" and on the next page request a new one is to be created. Usually an idle persistent connection lives 8 hours before it is automatically closed. So during this time you hit the maximum connection limit that usually is 150.

-----------------------------------------
Edit: The explanation may not be correct, it may be more complicated. Anyway, avoid persistent connection as a workaround.
-----------------------------------------

A workaround: Switch for now to ‘pconnect’ => FALSE ,
By the way: When in the future the newest Session library appears to 'develop' repository, check whether ‘pconnect’ => TRUE , is applicable at all.

About the permanent solution: The text will continue on GitHub.


Messages In This Thread
Impossible to load database (Session file Error) and too many connexions with mysqli driver with CI 3.0 - by El Forum - 07-13-2014, 05:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB