Bug #73307 [NEW]: Stream Socket Server unable to create IPv4/IPv6 Sockets
| From: | lucius at luciusgaitan dot com | Date: | Wed, 12 Oct 2016 16:45:20 +0000 |
| Subject: | Bug #73307 [NEW]: Stream Socket Server unable to create IPv4/IPv6 Sockets | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-204646@lists.php.net to get a copy of this message | ||
From: lucius at luciusgaitan dot com
Operating system: CentOS 7.2.1511 x64
PHP version: 7.0.11
Package: Unknown/Other Function
Bug Type: Bug
Bug description:Stream Socket Server unable to create IPv4/IPv6 Sockets
Description:
------------
Having a dual stack server, php is unable to create two sockets in the
same port for different addresses ipv4 and ipv6.
Only the first attempt to create the socket succeeds, the second returns
"PHP Warning: stream_socket_server(): unable to connect to ... (Address
already in use)".
Using the defaults 0.0.0.0 and [::]. If the real ip addresses are
defined everything works well.
Also, $errno equals to 0 and returned value is FALSE as described in
/manual/en/function.stream-socket-server.php.
./configure --with-config-file-path=/etc --disable-short-tags
--enable-bcmath --enable-calendar --enable-gd-native-ttf
--enable-mbstring --enable-pdo=shared --enable-sockets --enable-zip
--with-curl=/opt/curlssl/ --with-freetype-dir=/usr --with-gd
--with-jpeg-dir=/usr --with-mysqli --with-openssl --with-pcre-regex
--with-pdo-mysql=shared --with-pdo-sqlite=shared --with-pic
--with-png-dir=/usr --with-zlib --with-zlib-dir=/usr --enable-pcntl
--with-bz2 -enable-opcache --enable-fpm --with-fpm-systemd
Thank you.
Test script:
---------------
$errno = null; $error = null;
$bindto = ['0.0.0.0', '[::]'];
$socket = [];
for ($x = 0; $x < 2; ++$x) {
$ctx = stream_context_create(['socket' => ['bindto' => $bindto[$x] .
':3672']]);
$socket[] = stream_socket_server('tls://' . $bindto[$x] . ':3672',
$errno, $error, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $ctx);
}
--
Edit bug report at https://bugs.php.net/bug.php?id=73307&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73307&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73307&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73307&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73307&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73307&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73307&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73307&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73307&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73307&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73307&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73307&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73307&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73307&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73307&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73307&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73307&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73307&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73307&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73307&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73307&r=mysqlcfg