Welcome Guest, Not a member yet? Register   Sign In
Transactions & Orphan MySQL connections
#11

[eluser]Unknown[/eluser]
I am having a similar issue. I have a huge number of processes running on the server. The command is "Sleep" for all of them. Any query that is run opens a process and leaves it open. I am not using persistent connections (default setup in CI) so as far as I know these should be closed when the query is completed. I am using PHP 5.2.4 and MySQL 5.0.22. I have looked into setting the wait_timeout in the my.cnf file but can't get that to work (and, as far as I am concerned, shouldn't have to). Any insight into the problem would be greatly appreciated.

Thanks,
Jason
#12

[eluser]Unknown[/eluser]
if this is true, it could explain what is happening to our site this morning. I am running 10 web servers behind a load balancer, and each one is dying because my php processes are growing so large and staying around so long, that my servers are having to thrash the swap to provide enough memory and i am getting paging errors and my servers hang.

my db is fine, no huge cpu load, but i see hundreds of sleep connections. A quick look in my log file and i see some PHP fatal errors that started up about the same time as my site started to die.
PHP Fatal error: /data/htdocs/website/system/application/models/pointtypes_model.php on line 30.

if each of these errors leaves the mysql db connection open, its a huge bug in CI.
#13

[eluser]jonsolo11[/eluser]
I just fixed it, kinda.

If you can, use the "mysql" driver, not the "mysqli" driver. I tried this, and I no longer get sleeping connections.

I still don't know what causes the bug, but at least it's (somewhat) fixable
#14

[eluser]bretticus[/eluser]
Has this bug been fixed. I just had the same issue:

CI 1.7.1
mysql driver
PHP Version 5.2.0
MySQL Server 5.0.32

Lots of sleeping connections. Crashed my database server recently for all our clients (doh!) It's just the CI projects too.
#15

[eluser]bretticus[/eluser]
Nevermind,

pconnect was on. This appears to be the default for CI. This is fine for your laptop but really BAD on a shared server. I think there should be a warning or pconnect should be OFF by default.
#16

[eluser]Unknown[/eluser]
hy!
I turned the pconnect off. It works, when for example:
$this->db->trans_start();
delete_customer($id);
non_exist_function(); // fatal error
$this->db->trans_complete();

The querys in the delete_customer will be rollback. Ok.
But, when a php notice is throwed, for example:
Notice: Trying to get property of non-object....
anywhere in the delete_customer function, the rollback will not happen... any idea?
Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB