0
我正在使用xmlrpc聯繫本地服務器。在客戶端,有時會發生以下套接字超時錯誤並且不會發生一致性錯誤。 爲什麼會發生?什麼可能是套接字超時的原因?python xmlrpc超時錯誤
<class 'socket.timeout'>: timed out
args = ('timed out',)
errno = None
filename = None
message = 'timed out'
strerror = None
回溯在服務器端是如下
Exception happened during processing of request from ('127.0.0.1', 34855)
Traceback (most recent call last):
File "/usr/lib/python2.4/SocketServer.py", line 222, in handle_request
self.process_request(request, client_address)
File "/usr/lib/python2.4/SocketServer.py", line 241, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.4/SocketServer.py", line 254, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.4/SocketServer.py", line 521, in __init__
self.handle()
File "/usr/lib/python2.4/BaseHTTPServer.py", line 314, in handle
self.handle_one_request()
File "/usr/lib/python2.4/BaseHTTPServer.py", line 308, in handle_one_request
method()
File "/usr/lib/python2.4/SimpleXMLRPCServer.py", line 441, in do_POST
self.send_response(200)
File "/usr/lib/python2.4/BaseHTTPServer.py", line 367, in send_response
self.send_header('Server', self.version_string())
File "/usr/lib/python2.4/BaseHTTPServer.py", line 373, in send_header
self.wfile.write("%s: %s\r\n" % (keyword, value))
File "/usr/lib/python2.4/socket.py", line 256, in write
self.flush()
File "/usr/lib/python2.4/socket.py", line 243, in flush
self._sock.sendall(buffer)
error: (32, 'Broken pipe')
我殺了服務器並重新啓動它。它的工作現在很好。 可能是什麼原因? 昨天晚上,我的機器的RAM在整個過程中已經滿了,今天早上恢復正常。 這個錯誤是否會因爲一些進程的交換?
謝謝prashanth。在一些舊的utils代碼中有一個socket.setdefaulttimeout。 – 2012-01-09 15:04:29
我沒有在我的代碼中設置任何超時。是的,我的服務器在交換狀態時需要時間。 – 2012-01-10 08:50:13