Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Strange issue with Database_Connection on high-volume site
  • I'm using FuelPHP as a library (we don't have mod rewrite enabled, don't ask me why, so I am not able to use its controllers) for a high-volume site (1000+ visits per minute).

    It's working great, but there is one issue that happens sometimes that I am unable to figure out. Every so often we get an uncaught exception from the Database_Connection class saying "Table MyDB.MyTable does not exist", which apparently is coming directly from PHP's mysqli library. What's weird is that the database is correct, and the table does indeed exist on that database. I've checked into the connection information just in case it somehow was connecting to our development database, but I've also verified that this exception is getting thrown only with the live database, in which that table does exist.

    This could be an issue with mysqli, but I was wondering if any core developers have an idea why this would be happening - maybe it's something to do with how database connections are managed in Fuel? The exception is being thrown on line 130 of the Database_MySQLi_Connection class. It seems to happen about 3-4 times per day.

    Thanks
  • You can use Fuel without problems when you don't have mod_rewrite at your disposal. Only problem is that you'll have index.php visible in the URL (like http://example.org/index.php/controller/method).

    As to your error, I've never seen that behaviour before. Usually, with connection errors you'll get a 2006 (MySQL has gone away).

    I can't explain it either, it is making the DB connection there, there is no table name involved in that method.

    You don't have damaged innodb tables? Or a supersized ibdata file? Persistence issues (with connection re-use)? Nothing in the MySQL logs?

    Do you have the same issue if you switch to the "mysql" or "pdo" driver (should have no impact on your application, only some DBUtil methods are not supported by the PDO driver)?

  • Unfortunately the index.php/asdfasdf method won't work either (our sysadmin is insistent on running a completely barebones inginx server and is reluctant to add mod-rewrite and other stuff like that)

    I'll check out the logs and try with PDO to see if the issue still happens. Thanks for the help!
  • We noticed that this always happens at the top of the hour - turns out we have a cron for importing location data every hour, and because of the volume, we use a perl script our sysadmin wrote that imports the data to a temp table, deletes the old table, and then renames the temp one to the normal name. So apparently during that .01 second or whatever it is, when the old table doesn't exist and the new table hasn't been renamed, some poor guy is on the website trying to access location data and sees a blank white page.

    Basically I'm going to add a flag in the database and write a subclass of Database_MySQLi_Connection to look for "FROM locations" in any query that happens between :59 and :01 every hour, check the flag, and apply a sleep for half a second if necessary. Pretty crazy.

    Anyway, thanks for your help!
  • Glad you found the issue (and it's not the framework ;-)

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion