Skip to content

Conversation

@gustafsson
Copy link

When doing a

gsutil cp myfile gs://mybucket/name

With a https_proxy that was limiting the number of concurrent sockets. I got a

socket.timeout: timed out

During handling of the above exception, another exception occurred:
...
socks.GeneralProxyError: Socket error: timed out

During handling of the above exception, another exception occurred:
...
~/Applications/google-cloud-sdk/platform/gsutil/gslib/gcs_json_media.py", line 587, in _conn_request
    err = getattr(e, 'args')[0]

It seems socket.error can have empty args. This PR adds a check.

gsutil_IndexError_tuple_index_out_of_range.txt

Copy link
Collaborator

@dilipped dilipped left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late response here and thanks for the PR. Can you please add tests for the change? The test can go in the file tests/test_gcs_json_media.py.

except socket.error as e:
err = 0
if hasattr(e, 'args'):
if hasattr(e, 'args') and getattr(e, 'args'):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can replace the entire line with if getattr(e, 'args', None)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants