salt icon indicating copy to clipboard operation
salt copied to clipboard

cp.get_url with large files results in an Uncaught Exception

Open nbow opened this issue 10 years ago • 13 comments

When doing a cp.get_url with large files (5GB) I encounter a stacktrace:

2016-01-15 10:43:52,490 [tornado.application][ERROR ][2619] Uncaught exception
Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/tornado/http1connection.py", line 237, in _read_message
delegate.finish()
File "/usr/lib64/python2.7/site-packages/tornado/http1connection.py", line 637, in finish
return self._delegate.finish()
File "/usr/lib64/python2.7/site-packages/tornado/simple_httpclient.py", line 502, in finish
buffer = BytesIO(data) # TODO: don't require one big string?
MemoryError
2016-01-15 10:43:59,482 [salt.minion ][WARNING ][2619] The minion function caused an exception
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/salt/minion.py", line 1039, in _thread_return
return_data = func(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/salt/modules/cp.py", line 309, in get_url
return _context_['cp.fileclient'].get_url(path, dest, False, saltenv)
File "/usr/lib/python2.7/site-packages/salt/fileclient.py", line 622, in get_url
**get_kwargs
File "/usr/lib/python2.7/site-packages/salt/utils/http.py", line 438, in query
**req_kwargs
File "/usr/lib64/python2.7/site-packages/tornado/httpclient.py", line 102, in fetch
self._async_client.fetch, request, **kwargs))
File "/usr/lib64/python2.7/site-packages/tornado/ioloop.py", line 444, in run_sync
return future_cell[0].result()
File "/usr/lib64/python2.7/site-packages/tornado/concurrent.py", line 214, in result
raise_exc_info(self._exc_info)
File "<string>", line 3, in raise_xc_info
_QuietException

I can see that the bug was fixed for 2015.8.0 ( https://github.com/saltstack/salt/issues/24048 ). However, I can also see that in this issue ( https://github.com/saltstack/salt/pull/27394 ) the code was reverted, with no mention of the initial bug. There should be a way to transfer large files to a minion using salt.

nbow avatar Jan 18 '16 23:01 nbow

@nbow, thanks for the report. This issue should have been fixed although the final change(s) may not have been clearly linked to the issue you mention. Upgrading to 2015.8.3 should fix this problem.

jfindlay avatar Jan 19 '16 17:01 jfindlay

The above stacktrace was consistently encountered in a 2015.8.3 environment.

nbow avatar Jan 19 '16 17:01 nbow

@nbow, thanks for the extra info. @jacksontj, @DmitryKuzmenko, do you have any comments here? I will try to find and link any related issues, but I thought that this issue was supposed to be fixed.

jfindlay avatar Jan 19 '16 18:01 jfindlay

#26212 #26250 #26252 #27394

jfindlay avatar Jan 19 '16 18:01 jfindlay

From the exception there it seems that the minion ran our of memory-- is that the case? As of today salt pulls the entire response into memory before doing anything with it.

jacksontj avatar Jan 19 '16 21:01 jacksontj

That is entirely likely. I know that in 2015.8.0 this was an issue that was seen when using a salt url. That is why cp.get_url was used, which in that release did not have this problem. I'm not sure what everyone's idea of working is, but as a user it seems like a big problem that in order to transfer a large binary to a minion it needs to have large amounts of memory.

nbow avatar Jan 19 '16 21:01 nbow

@nbow, yeah, that is definitely a problem. Thanks for reporting.

jfindlay avatar Jan 19 '16 21:01 jfindlay

Confirm, the chunked fetching code was removed. I can follow this up in the middle of the next week.

DmitryKuzmenko avatar Jan 21 '16 08:01 DmitryKuzmenko

Thank you! Do you think it would be possible to get a fix in for the next release? I'm not looking for a commitment. I'm trying to plan what version of salt would be the next possible to which the environment would be updated. Thanks again!

nbow avatar Jan 21 '16 14:01 nbow

@nbow, it will probably be Boron before this comes out, or 2015.8.5, whichever comes first.

jfindlay avatar Jan 21 '16 22:01 jfindlay

Fixed. Waiting for tests and Thomas Jackson's CR.

DmitryKuzmenko avatar Jan 28 '16 16:01 DmitryKuzmenko

Done at all.

DmitryKuzmenko avatar Feb 01 '16 17:02 DmitryKuzmenko

Thanks for the help and work! I can verify that this is fixed in development and currently in 2016.3.

nbow avatar Feb 16 '16 19:02 nbow