views:

65

answers:

2

Hi I am doing papal integration with my django app.

i am using latest version of django from svn and python 2.6.

However, i found every time when paypal's sandbox accessing my notify url i got 500 [Errno 32] Broken pipe my django stack.

Does anyone have similar experience with this ?

Cheers,

Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 281, in run
    self.finish_response()
  File "/usr/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 321, in finish_response
    self.write(data)
  File "/usr/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 417, in write
    self._write(data)
  File "/usr/lib/python2.6/socket.py", line 318, in write
    self.flush()
  File "/usr/lib/python2.6/socket.py", line 297, in flush
    self._sock.sendall(buffer(data, write_offset, buffer_size))
error: [Errno 104] Connection reset by peer
----------------------------------------
Exception happened during processing of request from ('216.113.191.33', 21736)
Traceback (most recent call last):
  File "/usr/lib/python2.6/SocketServer.py", line 283, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python2.6/SocketServer.py", line 309, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python2.6/SocketServer.py", line 322, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 562, in __init__
    BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
  File "/usr/lib/python2.6/SocketServer.py", line 618, in __init__
    self.finish()
  File "/usr/lib/python2.6/SocketServer.py", line 661, in finish
    self.wfile.flush()
  File "/usr/lib/python2.6/socket.py", line 297, in flush
    self._sock.sendall(buffer(data, write_offset, buffer_size))
error: [Errno 32] Broken pipe
----------------------------------------
A: 

The first error Connection reset by peer show you that the connection have been closed by peer (in your case Pypal) and for the Error Broken pipe this error is raised when a connection is closed suddenly without informing the other peer (in your case your machine).

singularity
so is there anything i can do to prevent this happening?As i am testing against paypal sandbox, not sure this symptom will disappear if i use paypal live settings.Thanks
Grace Ladder
also, i deployed this by using uwsgi+nginx, i still got 500.
Grace Ladder
@Grace Ladder : like i said it's paypal that reset the connection , maybe you can edit your answer and add the code that you use to connect to paypal , hope this can help !
singularity
A: 

There are two problems. First, some of the paypal APIs (particularly MassPay) are terribly poor.

The second, and more likely, problem, is that your server is single-threaded and is having trouble properly raising an exception to paypal. I was able to resolve a similar problem by creating an html file with a form (via POST) that mocked a paypal IPN and then looking at the debug result (or better, using a debugger like the one in PyDev). You could do the same thing with curl of course.

Justin Myles Holmes
the funny thing was i tried with curl to mimic the post data, django server was survived, but get screwed when paypal called back. will do more checking shortly, cheers
Grace Ladder