s3cmd icon indicating copy to clipboard operation
s3cmd copied to clipboard

fails hard when sockettimeout is thrown

Open stefansjs opened this issue 3 years ago • 6 comments

ERROR: Exiting now because of fatal error

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    An unexpected error has occurred.
  Please try reproducing the error using
  the latest s3cmd code from the git master
  branch found at:
    https://github.com/s3tools/s3cmd
  and have a look at the known issues list:
    https://github.com/s3tools/s3cmd/wiki/Common-known-issues-and-their-solutions-(FAQ)
  If the error persists, please report the
  following lines (removing any private
  info as necessary) to:
   [email protected]


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Invoked as: /usr/local/bin/s3cmd sync -r -v s3://assets-temp .
Problem: timeout: timed out
S3cmd:   2.2.0
python:   3.9.10 (main, Jan 15 2022, 11:48:15) 
[Clang 12.0.0 (clang-1200.0.32.29)]
environment LANG=NOTSET

Traceback (most recent call last):
  File "/usr/local/bin/s3cmd", line 3209, in <module>
    rc = main()
  File "/usr/local/bin/s3cmd", line 3106, in main
    rc = cmd_func(args)
  File "/usr/local/bin/s3cmd", line 1967, in cmd_sync
    return cmd_sync_remote2local(args)
  File "/usr/local/bin/s3cmd", line 1533, in cmd_sync_remote2local
    ret, seq, size_transferred = _download(remote_list, seq, remote_count + update_count, size_transferred, dir_cache)
  File "/usr/local/bin/s3cmd", line 1378, in _download
    response = s3.object_get(uri, dst_stream, dst_file, extra_label = seq_label)
  File "/usr/local/Cellar/s3cmd/2.2.0_1/libexec/lib/python3.9/site-packages/S3/S3.py", line 763, in object_get
    response = self.recv_file(request, stream, labels, start_position)
  File "/usr/local/Cellar/s3cmd/2.2.0_1/libexec/lib/python3.9/site-packages/S3/S3.py", line 1975, in recv_file
    data = http_response.read(this_chunk)
  File "/usr/local/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 463, in read
    n = self.readinto(b)
  File "/usr/local/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 507, in readinto
    n = self.fp.readinto(b)
  File "/usr/local/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 704, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    An unexpected error has occurred.
  Please try reproducing the error using
  the latest s3cmd code from the git master
  branch found at:
    https://github.com/s3tools/s3cmd
  and have a look at the known issues list:
    https://github.com/s3tools/s3cmd/wiki/Common-known-issues-and-their-solutions-(FAQ)
  If the error persists, please report the
  above lines (removing any private
  info as necessary) to:
   [email protected]
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

'nuf said?

stefansjs avatar Mar 18 '22 23:03 stefansjs

I'm going work on this issue.

snosratiershad avatar Jun 08 '22 15:06 snosratiershad

I couldn't reproduce this issue, almost every time with direct response of http timeout and also with not giving a response until timeout reaches, s3cmd retries connection like this (10.0.0.0 for not responding):

WARNING: Waiting 3 sec...
WARNING: Retrying failed request: /?location (timed out)
WARNING: Waiting 6 sec...
WARNING: Retrying failed request: /?location (timed out)
WARNING: Waiting 9 sec...

and this (http://httpstat.us/504?sleep=60000 for direct responding):

WARNING: Waiting 3 sec...
ERROR: Error parsing xml: syntax error: line 1, column 0
ERROR: b'504 Gateway Timeout'
WARNING: Retrying failed request: /?location (504 (Gateway Timeout))
WARNING: Waiting 6 sec...
ERROR: Error parsing xml: syntax error: line 1, column 0
ERROR: b'504 Gateway Timeout'
WARNING: Retrying failed request: /?location (504 (Gateway Timeout))
WARNING: Waiting 9 sec...
ERROR: Error parsing xml: syntax error: line 1, column 0
ERROR: b'504 Gateway Timeout'
WARNING: Retrying failed request: /?location (504 (Gateway Timeout))
WARNING: Waiting 12 sec...

but I've found with 0 timeout BlockingIOError is unhandled:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    An unexpected error has occurred.
  Please try reproducing the error using
  the latest s3cmd code from the git master
  branch found at:
    https://github.com/s3tools/s3cmd
  and have a look at the known issues list:
    https://github.com/s3tools/s3cmd/wiki/Common-known-issues-and-their-solutions-(FAQ)
  If the error persists, please report the
  following lines (removing any private
  info as necessary) to:
   [email protected]


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Invoked as: /usr/bin/s3cmd info s3://test
Problem: <class 'BlockingIOError: [Errno 115] Operation now in progress
S3cmd:   2.2.0
python:   3.10.4 (main, Apr  2 2022, 09:04:19) [GCC 11.2.0]
environment LANG=en_US.UTF-8

Traceback (most recent call last):
  File "/usr/bin/s3cmd", line 3209, in <module>
    rc = main()
  File "/usr/bin/s3cmd", line 3106, in main
    rc = cmd_func(args)
  File "/usr/bin/s3cmd", line 986, in cmd_info
    info = s3.bucket_info(uri)
  File "/home/salar/.local/lib/python3.10/site-packages/s3cmd-2.2.0-py3.10.egg/S3/S3.py", line 484, in bucket_info
    response['bucket-location'] = self.get_bucket_location(uri)
  File "/home/salar/.local/lib/python3.10/site-packages/s3cmd-2.2.0-py3.10.egg/S3/S3.py", line 451, in get_bucket_location
    response = self.send_request(request)
  File "/home/salar/.local/lib/python3.10/site-packages/s3cmd-2.2.0-py3.10.egg/S3/S3.py", line 1480, in send_request
    conn = ConnMan.get(self.get_hostname(resource['bucket']))
  File "/home/salar/.local/lib/python3.10/site-packages/s3cmd-2.2.0-py3.10.egg/S3/ConnMan.py", line 284, in get
    conn.c.connect()
  File "/usr/lib/python3.10/http/client.py", line 941, in connect
    self.sock = self._create_connection(
  File "/usr/lib/python3.10/socket.py", line 845, in create_connection
    raise err
  File "/usr/lib/python3.10/socket.py", line 833, in create_connection
    sock.connect(sa)
BlockingIOError: [Errno 115] Operation now in progress

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    An unexpected error has occurred.
  Please try reproducing the error using
  the latest s3cmd code from the git master
  branch found at:
    https://github.com/s3tools/s3cmd
  and have a look at the known issues list:
    https://github.com/s3tools/s3cmd/wiki/Common-known-issues-and-their-solutions-(FAQ)
  If the error persists, please report the
  above lines (removing any private
  info as necessary) to:
   [email protected]
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
``

snosratiershad avatar Jun 08 '22 15:06 snosratiershad

@stefansjs, however if you can reproduce it, ETIMEDOUT 110 is the error code should be raised

snosratiershad avatar Jun 08 '22 15:06 snosratiershad

@snosratiershad We don't handle IO timeout errors because that are really unexpected cases that probably has to be checked by the user.

Is there still a change to do or a reproducible case to fix in your opinion?

fviard avatar Jul 02 '22 11:07 fviard

@fviard, I agree, IO errors should be unexpected cases and I don't know a specific expected type of IO error in S3 context.

snosratiershad avatar Jul 11 '22 07:07 snosratiershad

Wholeheartedly disagree. Network errors are to be expected, hence not exceptional. It should probably just generate a meaningful message to the user rather than appear as an application fault.

stefansjs avatar Jul 12 '22 06:07 stefansjs