Bug #47675 [ReO->Csd]: File descriptor leaked due to HAVE_BROKEN_GETCWD

From: Date: Fri, 05 Apr 2013 02:30:11 +0000
Subject: Bug #47675 [ReO->Csd]: File descriptor leaked due to HAVE_BROKEN_GETCWD
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-178303@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=47675&edit=1

 ID:                 47675
 Updated by:         rasmus@php.net
 Reported by:        cs at ecn dot purdue dot edu
 Summary:            File descriptor leaked due to HAVE_BROKEN_GETCWD
-Status:             Re-Opened
+Status:             Closed
 Type:               Bug
 Package:            Apache2 related
 Operating System:   Solaris 10
 PHP Version:        5.2.9
-Assigned To:        
+Assigned To:        rasmus
 Block user comment: N
 Private report:     N

 New Comment:

Will be in the next batch of releases


Previous Comments:
------------------------------------------------------------------------
[2013-04-04 20:56:28] davek at gamehouse dot com

Related To: Bug #64577

------------------------------------------------------------------------
[2011-09-28 00:58:18] jsjohnst@php.net

I've heard that this was fixed in PHP 5.3.5. It's not listed in the release notes 
from what I can see, so can someone confirm if 5.3.5 addresses this issue?

------------------------------------------------------------------------
[2011-05-18 18:23:29] pyorke at joyent dot com

This still broken in PHP 5.3.3

When is it going to be fixed

------------------------------------------------------------------------
[2010-08-08 10:20:55] php at marino dot st

I've been trying to track down this file descriptor leakage problem for months.  I was stuck on
5.2.8 because of it.  I confirm that the issue is specifically with Solaris 10.  I have opensolaris
sxce nevada 130 locally and I've not seen FD leakage on it.

I confirm that patch suggested by bryan at stansell dot org seemed to correct the problem.  FYI, PHP
was spawned and remains persistent for use with the Litespeed web server (uses the LSAPI interface),
so it would run out of file descriptors between 1 and 12 hours on my site.  It's a bit
disappointing that this error has been present for 5 releases and was never fixed.

------------------------------------------------------------------------
[2010-01-12 15:40:45] bryan at stansell dot org

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.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=47675


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=47675&edit=1


Thread (11 messages)

« previous php.bugs (#178303) next »