Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File upload fails with Connection Error #30

Open
torbenal opened this issue Feb 14, 2019 · 1 comment
Open

File upload fails with Connection Error #30

torbenal opened this issue Feb 14, 2019 · 1 comment

Comments

@torbenal
Copy link

Uploading a file returns the following error:
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))
I've been debugging for a while and can't figure out whether it's a problem with the module or Backblaze's services.

@remcoboerma
Copy link

I figure it probably has to do with threading.
See https://requests.readthedocs.io/en/master/user/advanced/#blocking-or-non-blocking:

Blocking Or Non-Blocking?
With the default Transport Adapter in place, Requests does not provide any kind of non-blocking IO. The Response.content property will block until the entire response has been downloaded. If you require more granularity, the streaming features of the library (see Streaming Requests) allow you to retrieve smaller quantities of the response at a time. However, these calls will still block.

As soon as the request.post is called it blocks and times out.

def upload_large_file(...):
  # inside upload_large_file is the worker::
  def upload_part_worker(...):
     # which uses upload_part to do the work
     upload_part_response = self.connector.upload_part(...)
       # to serve it 
       def upload_part(...): 
          # upload_part uses a regular blocking requests.post  from inside the upload_part_worker. 
          return requests.post(upload_url, headers=headers, data=data) 
          # and hangs...

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants