From: Pasi Oja-Nisula on
I have a xmlrpc server and client running on same Windows computer. The server
is part of a bigger program and client is a Cherrypy application that provides
a http interface to this program. Problem is that sometimes (1 out of 100) I
get xmlrpc ProtocolError without no apparent reason. The server receives the
message and does everything it's supposed to do. However, the client gets error
code -1.

I have been trying to reproduce the error but it's difficult. The contents of
the message don't seem to be the problem. There isn't a whole lot of traffic
either, we are talking about a message per minute or so.

This is what I get in the client program.

2010-06-22 15:15:40 ERROR exception occurred
Traceback (most recent call last):
File "C:\cygwin\home\Administrator\gsmsc\gsmschttp\gsmschttp.py", line 120, in
smsgw_act
server.add_outbound_from_dict(msg)
File "c:\Python26\lib\xmlrpclib.py", line 1199, in __call__
return self.__send(self.__name, args)
File "c:\Python26\lib\xmlrpclib.py", line 1489, in __request
verbose=self.__verbose
File "c:\Python26\lib\xmlrpclib.py", line 1243, in request
headers
ProtocolError: <ProtocolError for localhost:8000/RPC2: -1 >
2010-06-22 15:15:40 DEBUG url: localhost:8000/RPC2
2010-06-22 15:15:40 DEBUG headers: None
2010-06-22 15:15:40 DEBUG error code: -1
2010-06-22 15:15:40 DEBUG error msg:

This -1 seems to come from httplib and HTTP.getreply().

try:
response = self._conn.getresponse()
except BadStatusLine, e:
### hmm. if getresponse() ever closes the socket on a bad request,
### then we are going to have problems with self.sock

### should we keep this behavior? do people use it?
# keep the socket open (as a file), and return it
self.file = self._conn.sock.makefile('rb', 0)

# close our socket -- we want to restart after any protocol error
self.close()

self.headers = None
return -1, e.line, None

I'm not sure what this means. Probably I have some kind of http problem,
connection closed before client reads reply etc. How should I go forward
in solving this?

Pasi