requests: [Errno 2] _ssl.c:504: The operation did not complete (read)

I’m using rauth in my Django application and encoutering this error. rauth is based on requests, and looking at the traceback you can see that the error indeed comes from requests:

File "/www/srv/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  115.                         response = callback(request, *callback_args, **callback_kwargs)
File "./proj/apps/core/views.py" in end_pipeline
  62.                                             make_absolute(reverse('home'))})
File "/www/srv/lib/python2.7/site-packages/rauth/service.py" in get_auth_session
  533.         return self.get_session(self.get_access_token(method, **kwargs))
File "/www/srv/lib/python2.7/site-packages/rauth/service.py" in get_access_token
  518.         r = self.get_raw_access_token(method, **kwargs)
File "/www/srv/lib/python2.7/site-packages/rauth/service.py" in get_raw_access_token
  496.         return session.request(method, self.access_token_url, **kwargs)
File "/www/srv/lib/python2.7/site-packages/rauth/session.py" in request
  360.         return super(OAuth2Session, self).request(method, url, **req_kwargs)
File "/www/srv/lib/python2.7/site-packages/requests/sessions.py" in request
  335.         resp = self.send(prep, **send_kwargs)
File "/www/srv/lib/python2.7/site-packages/requests/sessions.py" in send
  438.         r = adapter.send(request, **kwargs)
File "/www/srv/lib/python2.7/site-packages/requests/adapters.py" in send
  331.                 raise SSLError(e)

Exception Type: SSLError at /accounts/end-pipeline/
Exception Value: [Errno 2] _ssl.c:504: The operation did not complete (read)

This seems to be caused by payloads larger than usual. The strange thing is that in the development environment it works perfectly, but not in production. And this is blocking the deployment. Please help me to solve this as soon as possible if you can.

I found only another issue with the same problem here: pika/pika#59. That was solved. There is an issue in Python tracker here: http://bugs.python.org/issue12343

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Comments: 24 (7 by maintainers)

Most upvoted comments

Thanks for the help, but this was my mistake - I had a local import in my breakout which had the line from gevent import monkey; monkey.patch_socket() embedded in it. It apparently wasn’t enough of a breakout! When switching patch_socket to patch_all the gevent error goes away. Maybe @rubik 's server is using patch_socket instead, I found that in examples of auto-reload servers.