Bug #74834 [NEW]: stream_socket_shutdown don't work!
| From: | 452476865 at qq dot com | Date: | Fri, 30 Jun 2017 10:39:23 +0000 |
| Subject: | Bug #74834 [NEW]: stream_socket_shutdown don't work! | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-209738@lists.php.net to get a copy of this message | ||
From: 452476865 at qq dot com
Operating system: ubuntu
PHP version: 5.6.30
Package: Streams related
Bug Type: Bug
Bug description:stream_socket_shutdown don't work!
Description:
------------
stream_socket_shutdown don't close the TCP connection.
this cause TCP connection overflow when high concurrency on WEB server.
i think stream_socket_shutdown should close TCP connection, not just
TIME_WAIT status.
Test script:
---------------
<?php
function one($host, $port){
$host = 'tcp://' . $host . ':' . $port;
$socket = @stream_socket_client(
$host,
$errorNumber,
$errorDescription,
ini_get("default_socket_timeout")
);
stream_socket_shutdown($socket, STREAM_SHUT_RDWR);
}
$host = '192.168.2.243';
$port = 7000;
for($i=0; $i<100; $i++){
one($host, $port);
}
echo "done";
?>
Expected result:
----------------
netstat -an |grep '192.168.2.243'
return :
none
Actual result:
--------------
netstat -an |grep '192.168.2.243'
return :
tcp 0 0 192.168.2.66:57336 192.168.2.243:7000
TIME_WAIT
tcp 0 0 192.168.2.66:57282 192.168.2.243:7000
TIME_WAIT
tcp 0 0 192.168.2.66:57222 192.168.2.243:7000
TIME_WAIT
tcp 0 0 192.168.2.66:57298 192.168.2.243:7000
TIME_WAIT
tcp 0 0 192.168.2.66:57236 192.168.2.243:7000
TIME_WAIT
tcp 0 0 192.168.2.66:57318 192.168.2.243:7000
TIME_WAIT
tcp 0 0 192.168.2.66:57398 192.168.2.243:7000
TIME_WAIT
--
Edit bug report at https://bugs.php.net/bug.php?id=74834&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74834&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74834&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74834&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74834&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74834&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74834&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74834&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74834&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74834&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74834&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74834&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74834&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74834&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74834&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74834&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74834&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74834&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74834&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74834&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74834&r=mysqlcfg