When I download using synapse get, the download starts but is interrupted. got this error ChunkedEncodingError: ("Connection broken: ConnectionResetError(104, 'Connection reset by peer')", ConnectionResetError(104, 'Connection reset by peer')) Thanks for help

Created by Saloe Bispo saloe
Hi!! unfortunately, It didn't happen this time import synapseclient **syn = synapseclient.login('', '')** syn.multi_threaded = False f = syn.get('syn23322113') print(f) Traceback (most recent call last): File "download_test_file.py", line 3, in syn = synapseclient.login('saloe', 'DTEO') File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/synapseclient/client.py", line 158, in login syn.login(*args, **kwargs) File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/synapseclient/client.py", line 394, in login sessionToken)) File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/synapseclient/core/credentials/credential_provider.py", line 115, in get_credentials creds = provider.get_synapse_credentials(syn, user_login_args) File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/synapseclient/core/credentials/credential_provider.py", line 36, in get_synapse_credentials return self._create_synapse_credential(syn, *self._get_auth_info(syn, user_login_args)) File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/synapseclient/core/credentials/credential_provider.py", line 41, in _create_synapse_credential retrieved_session_token = syn._getSessionToken(email=username, password=password) File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/synapseclient/client.py", line 455, in _getSessionToken headers=self.default_headers) File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/synapseclient/client.py", line 3695, in restPOST response = self._rest_call('post', uri, body, endpoint, headers, retryPolicy, requests_session, **kwargs) File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/synapseclient/client.py", line 3662, in _rest_call self._handle_synapse_http_error(response) File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/synapseclient/client.py", line 3641, in _handle_synapse_http_error exceptions._raise_for_status(response, verbose=self.debug) File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/synapseclient/core/exceptions.py", line 160, in _raise_for_status raise SynapseHTTPError(message, response=response) synapseclient.core.exceptions.SynapseHTTPError: 423 Client Error: You locked out from making any additional login attempts for 2003146 milliseconds
@saloe Oh sorry you can put your login credentials in the login line, e.g. ``` syn = synapseclient.login('', '') ``` I thought you might be using cached credentials. FYI if you prefer instead you can also cache your login so you don't need to enter it with each command e.g. from the command line, after which the above should work without explicitly entering your credentials as parameters. ``` synapse login -u --rememberMe ```
Hi, Sorry, I expressed myself badly The download didn't complete when I used it download_test_file.py and when I used the command below, it also didn't work import synapseclient syn = synapseclient.login() syn.multi_threaded = False f = syn.get('syn23322113') print(f) **Result:** Traceback (most recent call last): File "download_test_file.py", line 3, in syn = synapseclient.login() File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/synapseclient/client.py", line 158, in login syn.login(*args, **kwargs) File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/synapseclient/client.py", line 398, in login raise SynapseNoCredentialsError("No credentials provided.") synapseclient.core.exceptions.SynapseNoCredentialsError: No credentials provided.
@saloe Hmm, so it completed the straight 10gb download. Okay one more script to try. This will download the same 10GB file from Synapse with only one thread. It will be slower, but if your system is somehow limiting or throttling your outbound connections it might be interrupting the download, but it might be successful with a single thread. ``` import synapseclient syn = synapseclient.login() syn.multi_threaded = False f = syn.get('syn23322113') print(f) ```
Hi , Yes, it is probably a connection problem, because with a large file I get problems. the download stopped in '10737418240 bytes downloaded(py3.6)' using download_test_file.py
@saloe Hmm okay. So it seems to be multi gigabyte files are the ones where you are encountering the connection issues presumably (presumably more time for the unstable connection to manifest). With that established can you try the following (similar to the above to download a file using Python requests but outside of Synapse, but this time 10GB rather than 250MB). ``` import requests import sys # a 10GB binary file, content doesn't matter just using a large-ish file url = 'https://hb9gnaq7k7nw.s3.amazonaws.com/3405095/2fe04b17-bd09-4839-90a4-8300df8f2683/10gb.bin' chunk_size = 8192 bytes_downloaded = 0 r = requests.get(url, stream=True) for chunk in r.iter_content(chunk_size=chunk_size): bytes_downloaded += chunk_size sys.stdout.write(f'\r {bytes_downloaded} bytes downloaded') ``` As before you can save that to e.g. download_test_file.py and run it as ``` python3 download_test_file.py ``` If that succeeds then try downloading exact same file but through Synapse instead; ``` # download a 10GB file through synapse synapse get syn23322113 ```
Hi!!! **The bam file you listed above (syn4896456) is ~6GB, although I think you mentioned that there were others you were also unable to download to similar issues. Were they all of similar size?** I tried different sizes, but 6G was the smallest size **Can I ask what environment you are running these downloads on? Is this a desktop/laptop (if so wired/wifi) or a remote/cloud server?** it is a remote server, linux **Does the progress bar on the download advance to a consistent point (or at all) before you encounter these errors?** Oh yes, around 16% I get the error and the download restarts Downloading [####----------------]15.63% 1.0GB/8.3GB (4.5MB/s) 976_TCX.snap.bam.synapse_download_5105714
@saloe Hmm, okay that's interesting that all those were successful. The bam file you listed above (syn4896456) is ~6GB, although I think you mentioned that there were others you were also unable to download to similar issues. Were they all of similar size? Can I ask what environment you are running these downloads on? Is this a desktop/laptop (if so wired/wifi) or a remote/cloud server? Does the progress bar on the download advance to a consistent point (or at all) before you encounter these errors? Thanks!
Hiii!!! feel free to ask me to keep trying Thanks for all help all worked well -rw-rw---- 1 saloe.poubel saloe.poubel 1 Oct 14 17:11 1byte.bin -rw-rw---- 1 saloe.poubel saloe.poubel 1048576 Oct 14 17:12 1mb.bin -rw-rw---- 1 saloe.poubel saloe.poubel 268435456 Oct 14 17:16 250mb.bin
@saloe Hmm, that looks like you were able to successfully download that file from AWS using python/requests. Sorry to make you keep trying things but the following commands will test that you can download files of increasing size from Synapse. If even the first one fails then that would indicate some fundamental network/infrastructure issue. If they all succeed then there would seem to be some issue with the particular other Synapse entities you are downloading. Can you try each of the commands below? ``` # download a 1byte file synapse get syn23312654 # download a 1mb file synapse get syn23312364 # download a 250mb file synapse get syn23312634 ``` Thanks, Jordan
@jordank Hi!! I am very grateful for all the help. **Are you getting this behavior while downloading all Synapse entities or just one in particular?** Yes, I've tried several files and they all get the same errors ** Are you able to download other large file content over https from this machine without issue?** Yes, through https, I can download normally I tested your option in python and got this result (py3.6) [saloe.poubel@highz projeto_saloe]$ python3 download_test_file.py 268435456 bytes downloaded(py3.6) [saloe.poubel@highz projeto_saloe]$ I got : -rw-rw---- 1 root root 0 Oct 8 16:09 Paired-end -rw-rw---- 1 root root 0 Oct 8 16:09 Single-end Thanks
@saloe 1. Are you getting this behavior while downloading all Synapse entities or just one in particular? 2. Are you able to download other large file content over https from this machine without issue? Could you try running the following Python code. This script will just download a 250 MB file from AWS over https via Python using the requests library, which is the same stack that the synapse client is using. I'm curious if this completes successfully or if you encounter a similar issue. ``` import requests import sys # a 250 MB binary file, content doesn't matter just using a large-ish file url = 'https://hb9gnaq7k7nw.s3.amazonaws.com/250mb.bin' chunk_size = 8192 bytes_downloaded = 0 r = requests.get(url, stream=True) for chunk in r.iter_content(chunk_size=chunk_size): bytes_downloaded += chunk_size sys.stdout.write(f'\r {bytes_downloaded} bytes downloaded') ``` You could e.g. save this to a file called download_test_file.py and run it ``` python3 download_test_file.py ```
Hi! I used the debug as suggested and got: Retrying download on error: [] after progressing 0 bytes Traceback (most recent call last): File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/urllib3/response.py", line 436, in _error_catcher yield File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/urllib3/response.py", line 518, in read data = self._fp.read(amt) if not fp_closed else b"" File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/http/client.py", line 459, in read n = self.readinto(b) File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/http/client.py", line 503, in readinto n = self.fp.readinto(b) File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/socket.py", line 586, in readinto return self._sock.recv_into(b) File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/ssl.py", line 1012, in recv_into return self.read(nbytes, buffer) File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/ssl.py", line 874, in read return self._sslobj.read(len, buffer) File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/ssl.py", line 631, in read v = self._sslobj.read(len, buffer) ConnectionResetError: [Errno 104] Connection reset by peer During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/requests/models.py", line 751, in generate for chunk in self.raw.stream(chunk_size, decode_content=True): File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/urllib3/response.py", line 575, in stream data = self.read(amt=amt, decode_content=decode_content) File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/urllib3/response.py", line 540, in read raise IncompleteRead(self._fp_bytes_read, self.length_remaining) File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/contextlib.py", line 99, in __exit__ self.gen.throw(type, value, traceback) File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/urllib3/response.py", line 454, in _error_catcher raise ProtocolError("Connection broken: %r" % e, e) urllib3.exceptions.ProtocolError: ("Connection broken: ConnectionResetError(104, 'Connection reset by peer')", ConnectionResetError(104, 'Connection reset by peer')) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/synapseclient/client.py", line 1782, in _downloadFileHandle expected_md5=fileHandle.get('contentMd5')) File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/synapseclient/client.py", line 1819, in _download_from_url_multi_threaded multithread_download.download_file(self, request) File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/synapseclient/core/multithread_download/download_threads.py", line 232, in download_file downloader.download_file(download_request) File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/synapseclient/core/multithread_download/download_threads.py", line 297, in download_file self._write_chunks(request, completed_futures, transfer_status) File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/synapseclient/core/multithread_download/download_threads.py", line 372, in _write_chunks chunk_data = chunk_response.content File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/requests/models.py", line 829, in content self._content = b''.join(self.iter_content(CONTENT_CHUNK_SIZE)) or b'' File "/usr/local/anaconda3/envs/py3.6/lib/python3.6/site-packages/requests/models.py", line 754, in generate raise ChunkedEncodingError(e)
@saloe Can you run the same command using the --debug argument and copy any stack trace errors that are output in the console during the download to this thread? e.g. ``` synapse --debug get -r syn4896456 ``` Generally the synapse client will retry a failed download up to 5 times, running with the debug argument will cause it to output a stack trace with an error every time it encounters an error before retrying, so this should both reveal exactly where the in the process the ConnectionResetError occurred as well as reveal whether it failed 5 times before aborting.
Hi! I'm trying to download Transcriptome  .bam file,  using linux terminal the command that I used is synapse get -r syn4896456 I login with my Synapse username  my API key, the download starts, but after 16% of the downloaded file, I get the errorChunkedEncodingError: ("Connection broken: ConnectionResetError(104, 'Connection reset by peer')", ConnectionResetError(104, 'Connection reset by peer'))
Are you downloading through the web browser or using another client? Does the error always happen or just sometimes?

error ConnectionResetError page is loading…