Problem with socket.py

Laurent Pointal laurent.pointal at lure.u-psud.fr
Thu May 3 15:25:24 CEST 2001


Bonjour, 

I have a small Python 2.1 server script, using BaseHTTPServer and
SocketServer, which get datas from a mapped memory and make them
available via HTTP protocol. 

It works nice. I tried up to 4 concurrent clients making continuous
requests, they work... at 99.99%. 

Time to time, I have the following bug:

Exception in thread Thread-603:
Traceback (most recent call last):
  File "c:\python21\lib\threading.py", line 378, in __bootstrap
    self.run()
  File "c:\python21\lib\threading.py", line 366, in run
    apply(self.__target, self.__args, self.__kwargs)
  File "c:\python21\lib\SocketServer.py", line 246, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "c:\python21\lib\SocketServer.py", line 495, in __init__
    self.handle()
  File "c:\python21\lib\BaseHTTPServer.py", line 258, in handle
    self.raw_requestline = self.rfile.readline()
  File "c:\python21\lib\socket.py", line 233, in readline
    new = self._sock.recv(self._rbufsize)
AttributeError: 'int' object has no attribute 'recv'




My server is created like that:

class MemHTTPServer (SocketServer.ThreadingMixIn,
	    	    	BaseHTTPServer.HTTPServer) : 
    pass


class MemRequestHandler (BaseHTTPServer.BaseHTTPRequestHandler) :
    def do_GET(self) :
    	    ...here is my processing code...


def StartMemHTTPServer (addr="",port=80) :
    global g_server
    g_server = MemHTTPServer((addr,port),MemRequestHandler)
    g_server.serve_forever()



Have you already seen such a problem?



Thanks.


Laurent.



More information about the Python-list mailing list