skwashd/python-acquia-cloud

Download(backup database) file large is broken!

Closed this issue · 5 comments

When it has a very large backup, it happens this is breaking, I'm using python 2.7

File "./database.py", line 44, in main
backup.download(config['backup_file'])
File "/var/xxx/python2.7/site-packages/acapi/resources/backup.py", line 54, in download
content = self.request(uri=uri, params=query, decode_json=False)
File "/var/xxx/python2.7/site-packages/acapi/resources/acquiadata.py", line 97, in request
resp = requests.get(uri, auth=self.auth, headers=headers, params=params)
File "/var/xxx/python2.7/site-packages/requests/api.py", line 70, in get
return request('get', url, params=params, **kwargs)
File "/var/xxx/python2.7/site-packages/requests/api.py", line 56, in request
return session.request(method=method, url=url, **kwargs)
File "/var/xxx/python2.7/site-packages/requests_cache/core.py", line 128, in request
**kwargs
File "/var/xxx/python2.7/site-packages/requests/sessions.py", line 488, in request
resp = self.send(prep, **send_kwargs)
File "/var/xxx/python2.7/site-packages/requests_cache/core.py", line 101, in send
return send_request_and_cache_response()
File "/var/xxx/python2.7/site-packages/requests_cache/core.py", line 93, in send_request_and_cache_response
response = super(CachedSession, self).send(request, **kwargs)
File "/var/xxx/python2.7/site-packages/requests/sessions.py", line 641, in send
r.content
File "/var/xxx/python2.7/site-packages/requests/models.py", line 781, in content
self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()
MemoryError

@rhormens thanks the bug report. Google translate tells me you said

When I have a very large backup, it happens this is breaking, I'm using python 2.7.

The backtrace suggests that you're running out of memory. I have been using this library to request and download backups for some large sites. How big is the backup? How much memory is available to the process?

Sorry for writing the issue in Portuguese,

The backup is almost 700mb, and generally wherever the application has 1GB of free memory.
When I run my process python is only 300mb of memory.

Thank you for your help

@rhormens thanks for your patience on this. Recently my team hit this same issue on an internal project. The issue has been fixed in the 0.7.0 release that I cut earlier today.

Fixed in PR #12.