[Python-Dev] socket listen problem under aix

Guido van Rossum guido at python.org
Mon Nov 10 14:49:36 EST 2003


> i'm running python 2.2.3 under aix 4.3.3 compiled with gcc version 
> 2.9-aix51-020209.
> 
> subsequent accept calls in the socket library block after a defined 
> number of calls depending on the accept queue size. the call then never 
> returns, a connection to the server port gets a timeout and netstat -a 
> still shows the port as listening.
> 
> see the following example code:
> 
> ----
> import socket
> queue_size = 6
> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> s.bind(("", 7111))
> s.listen(queue_size)
> while 1:
> 	(c, addr) = s.accept()
> 	c.close()
> ----
> 
> depending on "queue_size" the loop blocks after n calls:
> 
> size calls
> 1	1
> 2	3
> 3	4
> 4	6
> 5	7
> 6	9
> 
> i've tried the same code on various other systems with different python 
> versions -> no problem at all. looks like that some ressources for the 
> tcp connection queue are not freed any more.

Almost certainly the problem is either in AIX or in your understanding
of how sockets work, and not in Python's socket module.  The socket
module just calls the underlying system calls; it doesn't introduce
this kind of problems by itself (but it doesn't prevent you from
making a bogus sequence of calls either).

If you want help debugging this issue, comp.lang.python would be a
more appropriate place to ask.  (My immdiate question after seeing
your code above is, what is the client doing?)

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list