|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-03-16 14:07 UTC] cs at ecn dot purdue dot edu
Description: ------------ mod_php contains a potential file descriptor leak on Solaris 10 when script executes "exit()". Reproduce code: --------------- <?php exit(0); ?> The change in behavior is due to the addition of HAVE_BROKEN_GETCWD for Solaris 10. In php_execute_script, a file descriptor is opened to hold the current working directory, but is not closed in the case where php code may not return to this function after executing a script. mod_php isn't aware of the resource that was allocated and not freed. Expected result: ---------------- Normally web server runs for days without resource trouble. In the case where a PHP script does an "exit(0)", the web server will run out of file descriptors and will need restarting. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 01:00:01 2025 UTC |
I finally got a chance to test a theory. Looks like the volatile attribute fixed things for me. #if HAVE_BROKEN_GETCWD volatile int old_cwd_fd = -1; #else Once I added that, the setjmp/longjmp worked as expected. I got the idea from the manpage on Solaris: The values of register and automatic variables are unde- fined. Register or automatic variables whose value must be relied upon must be declared as volatile. Perhaps it's a gcc/gas/Solaris/x86 optimization somewhere that overlooked the case, but this is a workaround. Of course, undefining HAVE_BROKEN_GETCWD for Solaris also works, if you have a web tree that isn't restricted in some way.