From:
Operating system: ubuntu
PHP version: 5.4.3
Package: Streams related
Bug Type: Bug
Bug description:socket don't close
Description:
------------
pleses exec test script.
Test script:
---------------
******************************test.php**************************
#! /usr/bin/php
<?php
$errno=0;
$errstr='';
$socket = stream_socket_server("tcp://0.0.0.0:4321", $errno, $errstr);
$while=__DIR__.DIRECTORY_SEPARATOR.'while.php > /dev/null &';
`$while`;
unset($socket);
echo `lsof -i:4321`;
******************************test.php end**********************
******************************while.php**************************
#! /usr/bin/php
<?php
while(true){}
******************************while.php end**********************
Expected result:
----------------
****************************** first exec ******************************
root@ubuntu:~# ./test.php
****************************** second exec ******************************
root@ubuntu:~# ./test.php
Actual result:
--------------
****************************** first exec ******************************
root@ubuntu:~# ./test.php
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
while.php 29664 root 3u IPv4 61634581 0t0 TCP *:4321 (LISTEN)
****************************** second exec ******************************
root@ubuntu:~# ./test.php
PHP Warning: stream_socket_server(): unable to connect to
tcp://0.0.0.0:4321
(Address already in use) in /root/test.php on line 5
Warning: stream_socket_server(): unable to connect to tcp://0.0.0.0:4321
(Address
already in use) in /root/test.php on line 5
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
while.php 29664 root 3u IPv4 61634581 0t0 TCP *:4321 (LISTEN)
--
Edit bug report at https://bugs.php.net/bug.php?id=62001&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=62001&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=62001&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=62001&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=62001&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=62001&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=62001&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=62001&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=62001&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=62001&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=62001&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=62001&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=62001&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=62001&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=62001&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=62001&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62001&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=62001&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=62001&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=62001&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=62001&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=62001&r=mysqlcfg