• 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI_DB_driver Bug?

#21
There definitely seems to be some sort of issue with the mysqli driver on v3. I've been using 1.x and 2.x for years on the same server and development environment. This morning, I upgraded to 3.0 RC2, and I've been getting the same intermittent messages that others are reporting: "Message: mysqli::real_connect() [mysqli.real-connect]: MySQL server has gone away". The page takes forever to load, as it's waiting for some sort of timeout. This issue happens about 30% of the page loads.
For me, I turned off compression in the db config, and I haven't seen it since.
I'm connecting to mysql server 5.0.77 and have client api library 5.0.11. Also, PHP 5.6.5.

$db[$group]['dbdriver'] = 'mysqli';
$db[$group]['dbprefix'] = '';
$db[$group]['pconnect'] = TRUE;
$db[$group]['db_debug'] = FALSE;
$db[$group]['cache_on'] = FALSE;
$db[$group]['cachedir'] = '';
$db[$group]['char_set'] = 'utf8';
$db[$group]['dbcollat'] = 'utf8_general_ci';
$db[$group]['swap_pre'] = '';
$db[$group]['autoinit'] = TRUE;
$db[$group]['encrypt'] = FALSE;
$db[$group]['compress'] = FALSE; // Setting sompress to TRUE starts the intermittent connection issues
$db[$group]['stricton'] = FALSE;
$db[$group]['failover'] = array();
$db[$group]['save_queries'] = FALSE;
Reply

#22
(02-11-2015, 03:58 PM)Narf Wrote: You can rant all day long, but that's not going to change how things work ... If you don't want to take my advice, that's fine with me.

The advice you gave me, i already knew all those solutions by googling and reading MySQL forum, i wanted to know if there is a way to handle it through CI, whatever you call it MySQL behavior or anything, CI is reading it and giving the warning not MySQL, i just wanted CI to not show just this warning. All you had to say that there is no way CI can handle such things, like suppressing specific warning messages, by any means my question was valid. and you couldn't admit that CI can't do it. there is no harm in it if a piece of code does one thing and doesn't handle all the users scenarios.

Regards.
Reply

#23
(02-11-2015, 11:19 PM)summer Wrote:
(02-11-2015, 03:58 PM)Narf Wrote: You can rant all day long, but that's not going to change how things work ... If you don't want to take my advice, that's fine with me.

The advice you gave me, i already knew all those solutions by googling and reading MySQL forum, i wanted to know if there is a way to handle it through CI, whatever you call it MySQL behavior or anything, CI is reading it and giving the warning not MySQL, i just wanted CI to not show just this warning. All you had to say that there is no way CI can handle such things, like suppressing specific warning messages, by any means my question was valid. and you couldn't admit that CI can't do it. there is no harm in it if a piece of code does one thing and doesn't handle all the users scenarios.

Regards.

I have no problem admitting that CI can't do something.
I have a problem with you insisting that this is a CI problem.

For the Nth time - it's not a CodeIgniter problem. All CI knows about this error is that there's an E_ERROR message emitted by PHP. It doesn't look at the message, it doesn't decide what the message is, it just displays it and there's no way to change that unless you tell it to stop displaying all errors.

If anybody has a suggestion for how to avoid the issue - please share it, but just suppressing the error is never the solution.
Reply

#24
There is this one settings in database.php config file:
Code:
'autoinit' => TRUE,

Documentaion says:
Code:
autoinit    Whether or not to automatically connect to the database when the library loads. If set to false, the

connection will take place prior to executing the first query.

I thought lets try this, may be this will help me with the case but instead i got this:

Code:
A PHP Error was encountered

Severity: Error

Message: Call to a member function real_escape_string() on a non-object

Filename: mysqli/mysqli_driver.php

Line Number: 335

Backtrace:
Reply

#25
https://github.com/bcit-ci/CodeIgniter/c...3e3546fc22
Reply

#26
I just now realized that mysqli persistent connections were added as a new feature in 3.0, and previously the pconnect config settings was just ignored. So I thought I've been using persistent connections all along, but apparently that wasn't the case.
So anyways, I have no idea why my system is giving me all these "Gone away" errors so quickly, but it's not CI's problem (unless the application could somehow prevent and/or reconnect).
For me, I'm just turning persistent connections off so my application is back to performing how it always did.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.