[Python-bugs-list] [ python-Bugs-424951 ] ThreadingTCPServer file handle errors.
noreply@sourceforge.net
noreply@sourceforge.net
Fri, 06 Jul 2001 09:29:23 -0700
Bugs item #424951, was opened at 2001-05-17 12:31
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=424951&group_id=5470
Category: Extension Modules
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jeff Largent (jlargent)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: ThreadingTCPServer file handle errors.
Initial Comment:
When running a server using ThreadingTCPServer if the
server sit for several minutes between requests the
first request it receives will error with a bad file
handle error.
Python 2.1 (#1, Apr 20 2001, 15:04:11)
[GCC 2.96 20000731 (Red Hat Linux 7.0)] on linux2
#!/usr/bin/python2
from SocketServer import ThreadingTCPServer,
BaseRequestHandler
class myHandler (BaseRequestHandler):
def handle(self):
while 1:
data = self.request.recv(1024)
if not data: break
self.request.send('%s' % (data))
self.request.close
if __name__ == '__main__':
addr = ('localhost', 50000)
s = ThreadingTCPServer(addr, myHandler)
s.serve_forever()
Start this server wait several min then
using the echo-client.py from oreilly Programming
Python to
send it data.
Traceback (most recent call last):
File
"/var/tmp/python2-2.1-root/usr/lib/python2.1/threading.py",
line 378, in __bootstrap
self.run()
File
"/var/tmp/python2-2.1-root/usr/lib/python2.1/threading.py",
line 366, in run
apply(self.__target, self.__args, self.__kwargs)
File
"/var/tmp/python2-2.1-root/usr/lib/python2.1/SocketServer.py",
line 246, in finish_request
self.RequestHandlerClass(request, client_address,
self)
File
"/var/tmp/python2-2.1-root/usr/lib/python2.1/SocketServer.py",
line 495, in __init__
self.handle()
File "./server.py", line 10, in handle
data = self.request.recv(1024)
error: (9, 'Bad file descriptor')
Any requests sent right after this will complete
properly.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=424951&group_id=5470