Yesterday encountered a problem, using the YII framework to write PHP script, the DB more than 1 million of the data export, run, successful.
However, when running to No. 490000, the script terminates, prompting the error "File size limit exceeded", so Google, originally a file size exceeded the system limit. The author first reaction, the log file is full??? Quickly view log, incredibly only dozens of k!!! So where is this "big file"?
To start analysis, it is not possible to be a yii framework problem, this is the Linux operating system exception problem and frame without light, nor log file size, carefully look at all the settings log path of the file, are small can be ignored, even if the Yii debug turned off, there are the same problem.
Then change the idea, rerun the script, run the script again, found that dead time is very regular, are in 450,000 records hang, a little more than a lot, began to doubt the process. Decide to view the IO that the script process affects.
1, first get the script process <pid>;
2, use the lsof command to view this PID IO situation: Lsof-p <pid>
Found a suspected file data0/xdebug/cachegrind.out.<pid>, with the execution of the script, the size of this Xdebug file will also increase, and finally, the wish, hang off! At this point the file size is: 2147483647!!
Haha, good familiar figures, 2^31-1!!
It looks like the problem has been found, and as the script executes, Xdebug also writes a log of the script process, which is hung as scheduled when the file size exceeds the file size that the system can support.
OK, turn the xdebug off, run the script again, more than 1 million of the records run smoothly, get it done.
PS: The author uses the server for 32-bit system, and in 32-bit operating system, by the binary, its maximum storage data is 1111111111111111111111111111111.
Because of this, the decimal system embodied in other visual systems is 2147483647.