Solution to the File size limit exceeded error

  • 2020-06-15 07:50:35
  • OfStack

I encountered a problem yesterday. I used Yii framework to write php script, exported more than 1 million data in db, ran it successfully.

However, when running to 490,000, the script stopped and the error "File size limit exceeded" was prompted. It turned out that a file size exceeded the system limit. My first reaction is that the log file is full. I rushed to check log, only a few 10K!! So where is this "big file"?

At the beginning of analysis, it could not be the problem of Yii framework, this is the EXCEPTION problem of linux operating system and the framework without light, nor the log file size, carefully looked at all the files under the log path set, they are all small and can be ignored, even if debug of Yii is turned off, the same problem appears.

Then I changed my thinking, rerun the script, and rerun the script, and found that dead had a very regular time, which all died at 450,000 records, one more and one less, and I began to suspect that it was related to the process. Decide to see the io affected by the script process.

1. Get the script process first < pid > ;

2. Use lsof command to check the io of this pid: ES34en-ES35en < pid >

Find a suspected file data0 / xdebug/cachegrind out. < pid > As the script was executed, the size of the xdebug file increased, and finally, as desired, it died! At this time the file size is: 2147483647!!

Haha, that's a familiar number, 2^31 -1!!

The problem appears to have been found, and when the script was executed, xdebug also logged the script process. When the file size exceeded the size the system could support, it died as scheduled.

ok, turn off xdebug, re-run the script, over 1 million runs smoothly, done.

ps: the server for a 32-bit system, the author use in the 32-bit operating system, because it is 2 into the system, it can store the data is 1111111111111111111111111111111.

Because of this, the decimal representation in other visual systems is 2147483647.


Related articles: