SocketServer - Connection Reset By Peer (Randomly) 
Author Message
 SocketServer - Connection Reset By Peer (Randomly)

Hi all, please, any help would be much appreciated as I am going mad here
:-)

I am using Python's SocketServer.ThreadingTCPServer. It all works fine up to
a point. I have a single script called controller.py that resides in my
scriptalias folder. It's sole purpose  is to simply take a cgi request
convert it to an xml request and send it to the application server. Why ?
well later we might want to open it to other applications, so instead of
writing more code, other applications simply send an xml request directly to
the app server. The app server builds a request object and does some basic
validation then passes the request object to the Dispatcher instance that
will then dispatch it to the appropiate class in the model layer.

I can sometimes submit the webpage (controller.py) 10 times without an
Internal Server Error, and sometimes 3, its random, the http log files says:

File "/www/bi/cgi-bin/controller.py",line 30, in ?
response = sock.recv(1024)
socket.error: (104, 'Connection reset by peer')

Has anyone experienced this strange behaviour ?

Regards

Graeme



Mon, 28 Nov 2005 21:19:57 GMT  
 SocketServer - Connection Reset By Peer (Randomly)

Quote:

> I am using Python's SocketServer.ThreadingTCPServer. It all works fine up to
> a point.
...
> I can sometimes submit the webpage (controller.py) 10 times without an
> Internal Server Error, and sometimes 3, its random, the http log files says:

> File "/www/bi/cgi-bin/controller.py",line 30, in ?
> response = sock.recv(1024)
> socket.error: (104, 'Connection reset by peer')

It looks like you have a problem with the application server: it closes
the connection down. socket.recv dutifully informs you of that.
So, the application server is what I suspect. You have not shown any
code from it, so it is hard to pinpoint your problem.

One question: why are you using a home-grown solution for passing
objects between python applications instead of using something like
Pyro, CORBA, Twisted's perspective broker or XML-RPC? You are usually
better off *not* reinventing wheels.

Further debugging tips: take the webserver out of the question by
making controller.py be a command line script, and run it in a tight
loop. Then, put lots and lots of prints in your application server
(or maybe run it under PDB, though it might get tricky with threads)
to see where the problem is. But, again, my suggestion: go with tried
and true solutions.

--
Moshe Zadka -- http://www.*-*-*.com/
Buffy: I don't like you{*filter*} out with someone that... short.
Riley: Yeah, a lot of young people nowadays are experimenting with shortness.
Agile Programming Language -- http://www.*-*-*.com/



Tue, 29 Nov 2005 01:45:18 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Connection reset by peer

2. newbie - winsock error 10054 - connection reset by peer

3. VNC: Connection reset by peer

4. connection reset by peer while running exec

5. Win2k Peer to Peer and max connections

6. Cool new peer - to - peer tool

7. Peer to Peer

8. CPD 2: networking Windows98 peer-to-peer

9. Printing to a particular printer on Win'98 peer-to-peer Networks

10. Clipper on Win'98 peer-to-peer Networks

11. Win 95 Peer to Peer Network

12. Win 95 Peer to Peer Network (Summary)

 

 
Powered by phpBB® Forum Software