Fuel Cms creates many database process in sleep state

edited October 2023 in Bug Reports

Im new to Fuel CMS, Just want to ask what does this code below do it's in line 158 - 161 of C:\laragon\www\fuel\fuel\modules\fuel\core\MY_Model.php file. Because it seems like the empty($this->db) will always be true because If I check the value of $this->db it always NULL. I have many models called in my Home Page and it seems like this code below creates many mysql database connection that in sleep state. If I delete that code the unwanted mysql connections is gone and still my website is working properly.

                    // starting this code
        if (empty($this->db))
                    // to this code
        $CI =& get_instance();
        if (isset($CI->db))
            // create a copy of the DB object to prevent cross model interference
            $db = clone $CI->db;


  • There is a "dsn" property on a model that can be set for rare cases when the model's data pulls from a different database. If it's empty, it just uses the default database connection. How are you determining the number of connections in a sleep state (is there a query you run)?

  • Im just running SHOW PROCESSLIST command in my phpmyadmin. is it ok to delete that code? because it seems my project is working perfectly fine even if I commented it

  • edited October 2023

    Sometimes we're having "Too many connections" error in codeigniter and we found out that code in our projects creates many connections in database.

  • Thanks for the report. I've pushed that fix to the develop branch here if you want to merge it in.

  • Ok thank you very much :)

Sign In or Register to comment.