PDO has no ability to reconnect to the database. There's a particularly annoying error in MySQL (#2006: "MySQL server has gone away") that pops up when you're processing large amounts of data. It's not a huge deal, you just need to reconnect and carry on with what you're doing. PDO doesn't have this functionality native and it's annoying to put each of query in a while loop.
I'm not entirely convinced that it is caused by queries, though. For example, on our dev server (which no-one but me has access to), I can kill and then restart apache, not load a single web page, and leave it overnight. When I come back in the morning and try to load a page, it will give me the error even though not a single query was run.
I could be totally wrong (I've been wrong about every other way I've tried to resolve this problem over the last few weeks), but I think it has something to do with this:
I'm not ruling out @elieth 's digg link, though. Will try to work through it from that angle...
@Mark: from the stuff I've read, it does seem related to the connection "timing-out". But you're parameter looks like it 's the timeout while trying to connect, not once you're connected. I don't see how php could know a server side configuration.
So for it not to happen, you have to have every process with a connection not to ask for anything in 8 hours. Surely not something you will see in a production environnement.
The strangest thing is that on own dev/test server, I never saw it. Because 5.3 is in debian for a weeks, and mysql 5.1 a few month, and I had garden installed before both IIRC.
I know of a couple of communities that only have traffic Friday to Monday, also some(!) businesses that only work Monday to Friday. So I can immediately see two scenarios where it's possible to not have any kind of activity in 8 hours...
Comments
in particular
I'm not entirely convinced that it is caused by queries, though. For example, on our dev server (which no-one but me has access to), I can kill and then restart apache, not load a single web page, and leave it overnight. When I come back in the morning and try to load a page, it will give me the error even though not a single query was run.
@luc - I've got pdo_mysql 5.0.51a
I could be totally wrong (I've been wrong about every other way I've tried to resolve this problem over the last few weeks), but I think it has something to do with this:
I'm not ruling out @elieth 's digg link, though. Will try to work through it from that angle...
But you're parameter looks like it 's the timeout while trying to connect, not once you're connected. I don't see how php could know a server side configuration.
default timeout = 28800 sec -> 8 hours.
So for it not to happen, you have to have every process with a connection not to ask for anything in 8 hours.
Surely not something you will see in a production environnement.
The strangest thing is that on own dev/test server, I never saw it. Because 5.3 is in debian for a weeks, and mysql 5.1 a few month, and I had garden installed before both IIRC.
I've spoken to @Todd, and we're going to get these digg fixes integrated into our db class.
i'll just put up with it for now, and restart spawn-fcgi a couple times a week. thanks @mark and @todd for looking into this.