|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
[2015-09-03 12:11 UTC] cmb@php.net
-Status: Open
+Status: Analyzed
-Assigned To:
+Assigned To: cmb
[2015-09-03 12:11 UTC] cmb@php.net
[2015-09-03 12:27 UTC] cmb@php.net
-Summary: \PharData::compress lead to "too many open files"
+Summary: PharData::compress() doesn't close temp file
[2015-09-03 14:24 UTC] cmb@php.net
[2015-09-03 15:43 UTC] cmb@php.net
-Assigned To: cmb
+Assigned To:
[2015-09-03 15:43 UTC] cmb@php.net
[2017-01-05 17:52 UTC] cmb@php.net
[2017-01-05 17:52 UTC] cmb@php.net
-Status: Analyzed
+Status: Closed
[2017-01-05 17:53 UTC] cmb@php.net
-Assigned To:
+Assigned To: cmb
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 06:00:01 2025 UTC |
Description: ------------ I need to archive a lot (>1000 && <2000) of files into plenty small archives (~900) via PHP application. I used PharData class to create archives. During script run I recieved "failed to open dir: Too many open files" error. After debug my whole application I found that calling PharData::compress() open some /tmp file that is never closed. Calling compress() in a loop lead to rising count of open files. Test script: --------------- <?php function archiveDir($archiveName, $dir) { system("lsof -p ".getmypid()." | wc -l"); // on my local host give 72 $arch = new \PharData($archiveName); $arch->buildFromDirectory($dir); system("lsof -p ".getmypid()." | wc -l"); // on my local host give 73 - buildFromDirectory open $dir system("lsof -p ".getmypid()." | grep /tmp/"); // empty result - no /tmp/ files open $arch->compress(\Phar::GZ); system("lsof -p ".getmypid()." | wc -l"); // on my local host give 74 - compress open /tmp/phppI7yJX file } archiveDir("./testArchive.tar", "./"); system("lsof -p ".getmypid()." | wc -l"); // on my local host give 73 - $dir opened by DirectoryIterator (line 7) is closed system("lsof -p ".getmypid()." | grep /tmp/"); // we have still opened /tmp/phppI7yJX file Expected result: ---------------- Last lsof call should return same count of open files as first call of lsof. Actual result: -------------- lsof called after archiveDir() show, that we have one more open file than before archiveDir() call