From: mike at thetroubleshooters dot dk Operating system: Linux Fedora 8 PHP version: 5.2.5 PHP Bug Type: Zip Related Bug description: Zip is unusuable for large numbers of files or large data volume
Description: ------------ I have a system where I archive a very large amount of data, both the number of files can exceed 32000 and the volume of data can be much greater than 500M, then the ZipArchive is unusable, because it appears that it is impossible to get the ZipArchive to flush data, so that the memory usage, and file handle usage does not become excessive. Reproduce code: --------------- Do a simple loop to add 32000 files of 25k in size, and it is very easy to reproduce. Using Addfile fails silently, because you run out of filehandles. Using AddFromString fails with an out of memory error. Expected result: ---------------- I expected that the ZipArchive would start to flush data to the temporary file, at some stage, to prevent excessive memory or filehandle usage. Actual result: -------------- Using the AddFromString, quickly fills memory, and eventually will exceed the memory available, this is unfortunately a side effect of not processing the data as it is added. Program fails with an out of memory error. Using AddFile, will eventually run out of filehandles, unless the amount of filehandles are increased to enormous levels, which is not practical, nor a good idea. Program fails with no message in any logfile. In either case the script fails, which is annoying. I know that I am pushing the system to the limits with what I am doing, and likely the problem won't hit a lot of people. I read in another bug report, that data is not processed until close. The Main problem with the problem is that the addFile fails silently - that cost me a lot of time to diagnose. I recommend adding a flush() to the zipArchive, as this would solve the problem, if the problem cannot be solved easily by internal code, this would allow the coder to periodically flush it. Ofc. A open and close can possibly be used, but seems very clumsy. -- Edit bug report at http://bugs.php.net/?id=44070&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=44070&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44070&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44070&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44070&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=44070&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=44070&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=44070&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=44070&r=needscript Try newer version: http://bugs.php.net/fix.php?id=44070&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=44070&r=support Expected behavior: http://bugs.php.net/fix.php?id=44070&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=44070&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=44070&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=44070&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=44070&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=44070&r=dst IIS Stability: http://bugs.php.net/fix.php?id=44070&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=44070&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=44070&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=44070&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=44070&r=mysqlcfg
