#28996 [Opn->Csd]: fsockopen(unix_socket) and file descriptors leaking
| From: | wez@php.net | Date: | Fri, 02 Jul 2004 17:27:28 +0000 |
| Subject: | #28996 [Opn->Csd]: fsockopen(unix_socket) and file descriptors leaking | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-61630@lists.php.net to get a copy of this message | ||
ID: 28996
Updated by: wez@php.net
Reported By: b dot mourgues at newtech dot fr
-Status: Open
+Status: Closed
Bug Type: Sockets related
Operating System: linux
PHP Version: 4CVS-2004-07-02 (stable)
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
The next snapshot from snaps.php.net will contain the fix.
Previous Comments:
------------------------------------------------------------------------
[2004-07-02 18:30:41] b dot mourgues at newtech dot fr
Description:
------------
When using fsockopen with non "available" unix socket, fsockopen
returns FALSE (no file descriptor), but an unix socket remains opened
in webserver process running php.
run
watch -n 1 'lsof -U | grep ^apache | wc -l'
while opening the following page (replacing "apache" by the real name
of your webserver).
Suggestion : in file main/network.c, in function
_php_stream_sock_open_unix, when php_connect_nonb fails,
closesocket(socketd) should be invoked before returning NULL.
Reproduce code:
---------------
<?php
$PHPfd = fsockopen("/dev/null", 0, $PHPerrno, $PHPerrstr);
if($PHPfd)
{
fclose($PHPfd);
}
?>
<html><head><title>fsockopen</title></head>
<body>
<pre>
PID : <?php print getmypid() . " ". $PHPerrstr . "."; ?>
</pre>
</body></html>
Expected result:
----------------
When fsockopen returns FALSE, no file descriptor created by this
function should remain opened
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28996&edit=1