Suddenly My Models Don't Work Half The Time

I’ve been struggling with this for several days now and haven’t been able to make the slightest bit of progress. The problem is that for some reason my models are failing every once in awhile and not finding the table name they own. This doesn’t happen each page load but it happens at least 1 in 5 loads.

The error message I receive is always something like:

The table "time_message" for active record class "TimeMessage" cannot be found in the database.

The parts in quotes will change depending on which model gets lucky but the tables all actually exist and if I reload the page it will generally work as expected. This is happening occasionally on every page in the site. It doesn’t seem to be related to my model relations because I’ve seen it happen on models that have no FK and are not even used as a FK somewhere else.

The error is being thrown in the constructor: frameworks\yii\db\ar\CActiveRecord.php(2312)

This error doesn’t happen on my production server (which is Ubuntu). I’ve tried re-installing the WAMP package I’m using on the dev server. I’ve tried everything in this thread: http://tinyurl.com/a5t7fya .

I’ve tried getting a fresh Yii installation. I’ve adjusted my memory limits and cache duration. I’ve tried beating my head against a wall. Nothing has worked at all so far. This was all working without this problem for months and this issue suddenly came up (probably because of something stupid I did).

What does your apache and mysql error logs have to say? Sounds like a connection issue between the application code and mysql and not really a problem with Yii itself. SegFaults are very common on windows.

( because I’ve certainly never had this problem, but I developer on windows with a Ubuntu virtual machine to be as close to prod as possible. )

I deleted these before starting the services so this is only data from a single run. I also went to the site and refreshed until the error happened just in case that added more (which it did not).

I’ve since installed Kubuntu over my Windows installation. I never figured out why this was happening but I didn’t have time to figure it out. Everything is working perfectly from Linux.