question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ReadTimeoutError - how to change the timeout and avoid this error

See original GitHub issue

Hi, I had this script running fine in python2 every day loading the same amount of data, but today got and exception. The script is downloading and extracting a 1.7GB gzip file from S3 (10.4GB uncompressed).

[06:20:05] [INFO] [dku.utils]  -   File "<string>", line 135, in <module>
[06:20:05] [INFO] [dku.utils]  -   File "/usr/lib64/python2.7/gzip.py", line 455, in readline
[06:20:05] [INFO] [dku.utils]  -     c = self.read(readsize)
[06:20:05] [INFO] [dku.utils]  -   File "/usr/lib64/python2.7/gzip.py", line 261, in read
[06:20:05] [INFO] [dku.utils]  -     self._read(readsize)
[06:20:05] [INFO] [dku.utils]  -   File "/usr/lib64/python2.7/gzip.py", line 301, in _read
[06:20:05] [INFO] [dku.utils]  -     buf = self.fileobj.read(size)
[06:20:05] [INFO] [dku.utils]  -   File "/data/data1/dss/acode-envs/python/py2/env/lib/python2.7/site-packages/smart_open/s3.py", line 262, in read
[06:20:05] [INFO] [dku.utils]  -     self._fill_buffer(size)
[06:20:05] [INFO] [dku.utils]  -   File "/data/data1/dss/acode-envs/python/py2/env/lib/python2.7/site-packages/smart_open/s3.py", line 320, in _fill_buffer
[06:20:05] [INFO] [dku.utils]  -     bytes_read = self._buffer.fill(self._raw_reader)
[06:20:05] [INFO] [dku.utils]  -   File "/data/data1/dss/acode-envs/python/py2/env/lib/python2.7/site-packages/smart_open/bytebuffer.py", line 146, in fill
[06:20:05] [INFO] [dku.utils]  -     new_bytes = source.read(size)
[06:20:05] [INFO] [dku.utils]  -   File "/data/data1/dss/acode-envs/python/py2/env/lib/python2.7/site-packages/smart_open/s3.py", line 188, in read
[06:20:05] [INFO] [dku.utils]  -     binary = self._body.read(size)
[06:20:05] [INFO] [dku.utils]  -   File "/data/data1/dss/acode-envs/python/py2/env/lib/python2.7/site-packages/botocore/response.py", line 81, in read
[06:20:05] [INFO] [dku.utils]  -     raise ReadTimeoutError(endpoint_url=e.url, error=e)
[06:20:05] [INFO] [dku.utils]  - ReadTimeoutError: Read timeout on endpoint URL: "None"

This is not the same issue as https://github.com/RaRe-Technologies/smart_open/issues/312, because I can’t repeat this error, and there is no problem with encoding, the data was loaded fine in the next retry.

            with smart_open.smart_open( uri ) as fin:
                cnt=0
                for line in fin:
                    if cnt != 0 or not removeHeader:
                        f.write(line)
                    if cnt == 0:
                        header = line.strip()
                    cnt+=1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:7

github_iconTop GitHub Comments

3reactions
koshy1123commented, Aug 6, 2019

We’ve gotten around this by using resource_kwargs param within transport_params like so:

smart_open.open(
f's3://{bucket}/{key}', 
transport_params={
'session': so_session,
'resource_kwargs': {'config': so_config}})
0reactions
funes79commented, Aug 6, 2019

Thanks @koshy1123 as I said unfortunately I can’t repeat the error, but thanks for the help, will use this solution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do I receive a timeout error from Pythons requests module?
try: requests.post(url, headers, timeout=10) except requests.exceptions. ... ReadTimeout: # Set up for a retry, or continue in a retry loop.
Read more >
Connection Timeout vs. Read Timeout for Java Sockets
There can be several reasons for a connection timeout error: No service is listening to the given port on the remote host; The...
Read more >
pip fails with ReadTimeoutError - Ask Ubuntu
ReadTimeoutError : HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out. My Ubuntu version is: 16.04 (Xenial), and I'm running ...
Read more >
Timeout error on a callout to third party REST API
If the callout is timing out, please try and increase the timeout on the HTTP request to avoid that.
Read more >
How to solve read time out error in Apex callout?
You can't extend the timeout beyond two minutes, so it needs to respond within that time. Share.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found