ID: 12084
Updated by: thies
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Closed
Bug Type: PostgreSQL related
Operating System: Debian 2.2
PHP Version: 4.0.6
New Comment:

this is not a bug in php. here's the reply from 
Jan Wieck (PostgreSQL core guy) also read 
http://globecom.net/ietf/draft/draft-faber-time-wait-avoidance-00.html


    AFAIK  TIME_WAIT is the status TCP/IP connections 
enter after
    successful close to hold the port number for some  
time  just
    in  case  there  are retransmit packets and the like 
still on
    the wire, so that no other process right now can bind 
to this
    port and gets confused when these orphaned packets 
arrive.
 
    Well,  on  127.0.0.1  this  doesn't  really make 
sense. And I
    think it can be avoided by using SO_REUSE, but I'm  
not  100%
    sure on that.
 
    OTOH  it's  only a real problem if you open/close 
many, many,
    many (and I really mean many) connections in  a  short 
 time.
    These  TIME_WAIT's disappear after a while and they 
don't eat
    bread  in  the  meantime.  So  if  you  don't  run   
out   of
    unprivileged ports, why worry about them?




Previous Comments:
------------------------------------------------------------------------

[2001-07-13 08:12:06] [EMAIL PROTECTED]

this is not a bug in php. here's the reply from 
Jan Wieck (PostgreSQL core guy) also read 
http://globecom.net/ietf/draft/draft-faber-time-wait-avoidance-00.html


    AFAIK  TIME_WAIT is the status TCP/IP connections 
enter after
    successful close to hold the port number for some  
time  just
    in  case  there  are retransmit packets and the like 
still on
    the wire, so that no other process right now can bind 
to this
    port and gets confused when these orphaned packets 
arrive.
 
    Well,  on  127.0.0.1  this  doesn't  really make 
sense. And I
    think it can be avoided by using SO_REUSE, but I'm  
not  100%
    sure on that.
 
    OTOH  it's  only a real problem if you open/close 
many, many,
    many (and I really mean many) connections in  a  short 
 time.
    These  TIME_WAIT's disappear after a while and they 
don't eat
    bread  in  the  meantime.  So  if  you  don't  run   
out   of
    unprivileged ports, why worry about them?




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

[2001-07-12 02:42:29] [EMAIL PROTECTED]

php-4.0.6
postgres 7.1.2

I noticed a lot of sockets leaved in TIME_WAIT state in our application. so I worte a 
simple script

<pre>
for ($i = 0 $i < 100 ; $i++){
    $db = pg_open ("some string");
    pg_close($db);
}
<pre>

After that I noticed around 200 sockets in TIME _WAIT state. If I omit the pg_close 
statement averything works fine (and is considerably faster).
The same thing happens if I do a query before reopen a connection.
This bug is not reproducible with postgres 7.0.x

Thanks and goodbye

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



Edit this bug report at http://bugs.php.net/?id=12084&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to