This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author astrand
Recipients
Date 2004-06-21.09:36:13
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
The timeout stuff in the socket module does not work
correctly on Solaris. Here's a typical example:

import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(("localhost", 9048))
s.listen(1)
s.settimeout(10)
conn, addr = s.accept()
print 'Connected by', addr
while 1:
    data = conn.recv(1024)
    if not data: break
    conn.send(data)
conn.close()

When connecting, I get this traceback:

Connected by ('127.0.0.1', 32866)
Traceback (most recent call last):
  File "foo.py", line 10, in ?
    data = conn.recv(1024)
socket.error: (11, 'Resource temporarily unavailable')

This is because Python treats the new socket object as
blocking (the timeout value is -1). However, in
Solaris, sockets returned from accept() inherits the
blocking property. So, because the listenting socket
was in non-blocking mode, the new connected socket will
be non-blocking as well. Since the timeout is -1,
internal_select will not call select. 

The solution to this problem is to explicitly set the
blocking mode on new socket objects. The attached patch
implements this. 
History
Date User Action Args
2007-08-23 14:22:45adminlinkissue976613 messages
2007-08-23 14:22:45admincreate