Solution to the File size limit exceeded Error

Source: Internet
Author: User

Yesterday I encountered a problem. I used the Yii framework to write a php script to export and run more than 1 million of the data in the database.

However, when the script is running for 49th million lines, the error "File size limit exceeded" is returned. google prompts that the size of a File exceeds the system limit. The first response is that the log file is full ??? In a hurry to view logs, there are only dozens of K !!! So where is this "big file?

It is impossible to start the analysis because of the Yii framework. This is a linux operating system exception and the framework is not light, nor the log file size. You have carefully checked all the files in the configured log Path, even if the Yii debug is turned off, the same problem occurs.

In another way, we re-run the script and run the script again. We found that the time for dead was quite regular, and all of them were suspended when there were 0.45 million records. There were not many records, and we began to suspect that it was related to the process. Determines the io affected by the script process.

1. Obtain the <pid> of the script process first;

2. Run the lsof command to view the io status of the pid: lsof-p <pid>

We found a suspected file data0/xdebug/cachegrind. out. <pid>. With the execution of the script, the size of this xdebug file also increases. Finally, as expected, it will be suspended! The file size is 2147483647 !!

Haha, a familiar number, 2 ^ 31-1 !!

It seems that the problem has been found. During script execution, xdebug also records the write logs of the script process. When the file size exceeds the size of the files supported by the system, it will be suspended as scheduled.

OK. Turn xdebug off and re-run the script. the more than 1 million records are successfully completed.

Ps: the server used by the author is a 32-bit system. In a 32-bit operating system, the maximum data stored by the server is 1111111111111111111111111111111 because it is binary.

For this reason, the decimal Value embodied in other visual systems is 2147483647.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.