Bug #70417 [NEW]: \PharData::compress lead to "too many open files"
| From: | r-orlowski at o2 dot pl | Date: | Thu, 03 Sep 2015 10:34:28 +0000 |
| Subject: | Bug #70417 [NEW]: \PharData::compress lead to "too many open files" | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-195731@lists.php.net to get a copy of this message | ||
From: r-orlowski at o2 dot pl
Operating system: Ubuntu 14.04 LTS
PHP version: 5.6.12
Package: *Compression related
Bug Type: Bug
Bug description:\PharData::compress lead to "too many open files"
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
--
Edit bug report at https://bugs.php.net/bug.php?id=70417&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70417&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70417&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70417&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70417&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70417&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70417&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70417&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70417&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70417&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70417&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70417&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70417&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70417&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70417&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70417&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70417&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70417&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70417&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70417&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70417&r=mysqlcfg