Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

mysql server gone away, pdo not reconnecting

2»

Comments

  • eleitheleith New
    edited March 2010
    looks like digg wrote a wrapper in particular to get around some of issues they had with PDO [http://code.google.com/p/digg/wiki/PDB]

    in particular
    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.
  • MarkMark Vanilla Staff
    @eleith - Great link, thanks for that.

    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:

    image

    I'm not ruling out @elieth 's digg link, though. Will try to work through it from that angle...
  • MarkMark Vanilla Staff
    edited March 2010
    Just upgraded to PHP Version 5.2.4 ... we'll see...
  • lucluc ✭✭
    @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.
  • lucluc ✭✭
    http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_wait_timeout

    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 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...
  • MarkMark Vanilla Staff
    Hmmm.

    I've spoken to @Todd, and we're going to get these digg fixes integrated into our db class.
  • MarkMark Vanilla Staff
    btw - I haven't had this problem since upgrading my php version.
  • still having this problem intermittently on my end and i am running php 5.2.4.

    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.



Sign In or Register to comment.