I have a Zend/PHP script that reads rows from a table in one MySQL DB, transforms the data, and adds rows to a second table in another MySQL DB.
As I've bee debugging the script, it has been getting less and less far along before tossing an 开发者_开发问答error. Right now, after adding 60 rows, it quits. In the beginning it was adding 300+ rows. The source data hasn't changed.
I've got try...catch blocks around every ounce of code and I'm not getting anything but a generic "broken" style error - it's possible something is tossing an error in the Zend Framework that isn't being caught, but I don't understand the relation to rows being added.
It literally went from adding 83 rows to 80 to 74 to 63 to 60... with no code changes in between. I emptied the target database between tries. I've optimized and flushed the database, and I've restarted MySQL, I've restarted the WHOLE DARN SERVER... and it sticks with the same pattern.
Any wild guesses on what I could look at or try?
There must be data accumulating somewhere on disk (or on another machine you are not considering) or else you would not see a slowdown across restarts. I would have guessed a memory leak eating up VM and gradually forcing the machine into heavy swapping, slowing things down - but that, again, should not persist across restarts.
Assuming you are not bumping into some funky HW error, like a died cooling on a Pentium 4 or newer CPU, causing the CPU itself to gradually heat up and slow down as a response, making your script be able to do less and less work until it bumps into the script execution time limit configured in PHP.
The problem turned out to be a memory leak of some kind in MySQL - after persuading them to upgrade to a more 21st-century version, the problem vanished. We did verify the memory leak before doing so.
精彩评论