From: cwei...@php.net Operating system: PHP version: 5.2.9RC2 PHP Bug Type: Reproducible crash Bug description: resource ids get re-used when opening enough files
Description: ------------ Using php for long running daemons and opening files in there can lead to crashes, when resource ids wrap around the integer/long size and come to 0 at last. There is no sanity check if a resource is already in use when assigning it. This problem is more likely to appear on 32bit systems than on 64, since it takes ages to overflow that number with 64bit. Still, it is a problem. Example: - Open a file -> resource id is now +1 - Open many files. Eventually, it will reach MAX_INT or whatever number that is and wrap around to "-" that number, increasing from now on. - Double the time, and the script reaches an resource id of 0 - Now chances are very high that the an existing resource is at the same id - PHP crashes The problem has been - wrongly - described here: http://gnuvince.wordpress.com/2008/10/28/php-wrong-for-long-running-processes-wrong-for-america/ The issue is the one I described here -- Edit bug report at http://bugs.php.net/?id=47396&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47396&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47396&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47396&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=47396&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47396&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=47396&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=47396&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=47396&r=needscript Try newer version: http://bugs.php.net/fix.php?id=47396&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=47396&r=support Expected behavior: http://bugs.php.net/fix.php?id=47396&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=47396&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=47396&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=47396&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47396&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=47396&r=dst IIS Stability: http://bugs.php.net/fix.php?id=47396&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=47396&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=47396&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=47396&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=47396&r=mysqlcfg