Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.18.176 "global name 'wrap_socket' is not defined" when cmd involves any kind of http request #5718

Closed
2 tasks done
yaodingyd opened this issue Nov 12, 2020 · 8 comments
Closed
2 tasks done
Labels
dependencies This issue is a problem in a dependency.

Comments

@yaodingyd
Copy link

yaodingyd commented Nov 12, 2020

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug
A clear and concise description of what the bug is.

SDK version number
aws-cli/1.18.176 Python/2.7.6 botocore/1.19.16

Platform/OS/Hardware/Device
What are you running the cli on?
Linux/4.4.0-96-generic

To Reproduce (observed behavior)
Steps to reproduce the behavior
aws dynamodb list-tables (or any command makes http call)

Expected behavior
A clear and concise description of what you expected to happen.
An HTTP Client raised an unhandled exception: global name 'wrap_socket' is not defined

Logs/output
Get full traceback and error logs by adding --debug to the command.

2020-11-12 19:24:19,246 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/1.18.176 Python/2.7.6 Linux/4.4.0-96-generic botocore/1.19.16
2020-11-12 19:24:19,246 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['dynamodb', 'list-tables', '--debug']
2020-11-12 19:24:19,246 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_scalar_parsers at 0x7f2a3ae87c80>
2020-11-12 19:24:19,247 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function register_uri_param_handler at 0x7f2a39018488>
2020-11-12 19:24:19,247 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_assume_role_provider_cache at 0x7f2a38ff4848>
2020-11-12 19:24:19,247 - MainThread - botocore.utils - DEBUG - IMDS ENDPOINT: http://169.254.169.254/
2020-11-12 19:24:19,248 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function attach_history_handler at 0x7f2a38b39140>
2020-11-12 19:24:19,252 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/aws/local/lib/python2.7/site-packages/botocore/data/dynamodb/2012-08-10/service-2.json
2020-11-12 19:24:19,272 - MainThread - botocore.hooks - DEBUG - Event building-command-table.dynamodb: calling handler <function add_waiters at 0x7f2a3ae94488>
2020-11-12 19:24:19,276 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/aws/local/lib/python2.7/site-packages/botocore/data/dynamodb/2012-08-10/waiters-2.json
2020-11-12 19:24:19,277 - MainThread - awscli.clidriver - DEBUG - OrderedDict([(u'exclusive-start-table-name', <awscli.arguments.CLIArgument object at 0x7f2a38287c10>), (u'limit', <awscli.arguments.CLIArgument object at 0x7f2a38287c50>)])
2020-11-12 19:24:19,277 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.dynamodb.list-tables: calling handler <function add_streaming_output_arg at 0x7f2a3ae8d0c8>
2020-11-12 19:24:19,277 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.dynamodb.list-tables: calling handler <function add_cli_input_json at 0x7f2a38f7b2a8>
2020-11-12 19:24:19,278 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.dynamodb.list-tables: calling handler <function unify_paging_params at 0x7f2a3af06d70>
2020-11-12 19:24:19,282 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/aws/local/lib/python2.7/site-packages/botocore/data/dynamodb/2012-08-10/paginators-1.json
2020-11-12 19:24:19,284 - MainThread - awscli.customizations.paginate - DEBUG - Modifying paging parameters for operation: ListTables
2020-11-12 19:24:19,284 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.dynamodb.list-tables: calling handler <function add_generate_skeleton at 0x7f2a3aee8e60>
2020-11-12 19:24:19,285 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.dynamodb.list-tables: calling handler <bound method CliInputJSONArgument.override_required_args of <awscli.customizations.cliinputjson.CliInputJSONArgument object at 0x7f2a38287cd0>>
2020-11-12 19:24:19,285 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.dynamodb.list-tables: calling handler <bound method GenerateCliSkeletonArgument.override_required_args of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x7f2a3829a1d0>>
2020-11-12 19:24:19,286 - MainThread - botocore.hooks - DEBUG - Event operation-args-parsed.dynamodb.list-tables: calling handler <functools.partial object at 0x7f2a38309d60>
2020-11-12 19:24:19,286 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.list-tables.exclusive-start-table-name: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f2a386d2690>
2020-11-12 19:24:19,286 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.list-tables.limit: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f2a386d2690>
2020-11-12 19:24:19,287 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.list-tables.cli-input-json: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f2a386d2690>
2020-11-12 19:24:19,287 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.list-tables.starting-token: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f2a386d2690>
2020-11-12 19:24:19,287 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.list-tables.page-size: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f2a386d2690>
2020-11-12 19:24:19,288 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.list-tables.max-items: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f2a386d2690>
2020-11-12 19:24:19,288 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.dynamodb.list-tables.generate-cli-skeleton: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f2a386d2690>
2020-11-12 19:24:19,288 - MainThread - botocore.hooks - DEBUG - Event calling-command.dynamodb.list-tables: calling handler <bound method CliInputJSONArgument.add_to_call_parameters of <awscli.customizations.cliinputjson.CliInputJSONArgument object at 0x7f2a38287cd0>>
2020-11-12 19:24:19,288 - MainThread - botocore.hooks - DEBUG - Event calling-command.dynamodb.list-tables: calling handler <bound method GenerateCliSkeletonArgument.generate_json_skeleton of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x7f2a3829a1d0>>
2020-11-12 19:24:19,288 - MainThread - botocore.hooks - DEBUG - Event calling-command.dynamodb.list-tables: calling handler <bound method DynamoDBPaginatorFix._maybe_register_pagination_fix of <awscli.customizations.dynamodb.DynamoDBPaginatorFix object at 0x7f2a3877f190>>
2020-11-12 19:24:19,289 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: env
2020-11-12 19:24:19,289 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: assume-role
2020-11-12 19:24:19,289 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: assume-role-with-web-identity
2020-11-12 19:24:19,289 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: sso
2020-11-12 19:24:19,289 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: shared-credentials-file
2020-11-12 19:24:19,290 - MainThread - botocore.credentials - INFO - Found credentials in shared credentials file: ~/.aws/credentials
2020-11-12 19:24:19,292 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/aws/local/lib/python2.7/site-packages/botocore/data/endpoints.json
2020-11-12 19:24:19,356 - MainThread - botocore.hooks - DEBUG - Event choose-service-name: calling handler <function handle_service_name_alias at 0x7f2a39f59e60>
2020-11-12 19:24:19,358 - MainThread - botocore.hooks - DEBUG - Event creating-client-class.dynamodb: calling handler <function add_generate_presigned_url at 0x7f2a39fd02a8>
2020-11-12 19:24:19,361 - MainThread - botocore.endpoint - DEBUG - Setting dynamodb timeout as (60, 60)
2020-11-12 19:24:19,361 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/aws/local/lib/python2.7/site-packages/botocore/data/_retry.json
2020-11-12 19:24:19,363 - MainThread - botocore.client - DEBUG - Registering retry handlers for service: dynamodb
2020-11-12 19:24:19,365 - MainThread - botocore.hooks - DEBUG - Event before-parameter-build.dynamodb.ListTables: calling handler <function generate_idempotent_uuid at 0x7f2a39f61140>
2020-11-12 19:24:19,365 - MainThread - botocore.hooks - DEBUG - Event before-parameter-build.dynamodb.ListTables: calling handler <function block_endpoint_discovery_required_operations at 0x7f2a39ff3320>
2020-11-12 19:24:19,365 - MainThread - botocore.hooks - DEBUG - Event before-call.dynamodb.ListTables: calling handler <function inject_api_version_header_if_needed at 0x7f2a39f625f0>
2020-11-12 19:24:19,365 - MainThread - botocore.endpoint - DEBUG - Making request for OperationModel(name=ListTables) with params: {'body': '{}', 'url': u'https://dynamodb.us-east-1.amazonaws.com/', 'headers': {'User-Agent': 'aws-cli/1.18.176 Python/2.7.6 Linux/4.4.0-96-generic botocore/1.19.16', 'Content-Type': u'application/x-amz-json-1.0', 'X-Amz-Target': u'DynamoDB_20120810.ListTables'}, 'context': {'auth_type': None, 'client_region': 'us-east-1', 'has_streaming_input': False, 'client_config': <botocore.config.Config object at 0x7f2a37d97950>}, 'query_string': '', 'url_path': '/', 'method': u'POST'}
2020-11-12 19:24:19,366 - MainThread - botocore.hooks - DEBUG - Event request-created.dynamodb.ListTables: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x7f2a37d97910>>
2020-11-12 19:24:19,366 - MainThread - botocore.hooks - DEBUG - Event choose-signer.dynamodb.ListTables: calling handler <function set_operation_specific_signer at 0x7f2a39f61050>
2020-11-12 19:24:19,366 - MainThread - botocore.auth - DEBUG - Calculating signature using v4 auth.
2020-11-12 19:24:19,367 - MainThread - botocore.auth - DEBUG - CanonicalRequest:
POST
/

content-type:application/x-amz-json-1.0
host:dynamodb.us-east-1.amazonaws.com
x-amz-date:20201112T192419Z
x-amz-target:DynamoDB_20120810.ListTables

content-type;host;x-amz-date;x-amz-target
44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a
2020-11-12 19:24:19,367 - MainThread - botocore.auth - DEBUG - StringToSign:
AWS4-HMAC-SHA256
20201112T192419Z
20201112/us-east-1/dynamodb/aws4_request
2a3677b578c5bec134b7293e4882c54a6dc5cd7e222978636168fd3a80ba7367
2020-11-12 19:24:19,367 - MainThread - botocore.auth - DEBUG - Signature:
715b79eecaa486b2cf6dc63ee78d4216b65f593df7e5419e06d8d7f3214d3b78
2020-11-12 19:24:19,367 - MainThread - botocore.endpoint - DEBUG - Sending http request: <AWSPreparedRequest stream_output=False, method=POST, url=https://dynamodb.us-east-1.amazonaws.com/, headers={'Content-Length': '2', 'X-Amz-Target': 'DynamoDB_20120810.ListTables', 'X-Amz-Date': '20201112T192419Z', 'User-Agent': 'aws-cli/1.18.176 Python/2.7.6 Linux/4.4.0-96-generic botocore/1.19.16', 'Content-Type': 'application/x-amz-json-1.0', 'Authorization': 'AWS4-HMAC-SHA256 Credential=********************/20201112/us-east-1/dynamodb/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=715b79eecaa486b2cf6dc63ee78d4216b65f593df7e5419e06d8d7f3214d3b78'}>
2020-11-12 19:24:19,368 - MainThread - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): dynamodb.us-east-1.amazonaws.com:443
/usr/local/aws/local/lib/python2.7/site-packages/urllib3/util/ssl_.py:416: SNIMissingWarning: An HTTPS request has been made, but the SNI (Server Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
SNIMissingWarning,
2020-11-12 19:24:19,413 - MainThread - botocore.httpsession - DEBUG - Exception received when sending urllib3 HTTP request
Traceback (most recent call last):
File "/usr/local/aws/local/lib/python2.7/site-packages/botocore/httpsession.py", line 263, in send
chunked=self._chunked(request.headers),
File "/usr/local/aws/local/lib/python2.7/site-packages/urllib3/connectionpool.py", line 706, in urlopen
chunked=chunked,
File "/usr/local/aws/local/lib/python2.7/site-packages/urllib3/connectionpool.py", line 382, in _make_request
self._validate_conn(conn)
File "/usr/local/aws/local/lib/python2.7/site-packages/urllib3/connectionpool.py", line 1010, in validate_conn
conn.connect()
File "/usr/local/aws/local/lib/python2.7/site-packages/urllib3/connection.py", line 420, in connect
tls_in_tls=tls_in_tls,
File "/usr/local/aws/local/lib/python2.7/site-packages/urllib3/util/ssl
.py", line 424, in ssl_wrap_socket
ssl_sock = ssl_wrap_socket_impl(sock, context, tls_in_tls)
File "/usr/local/aws/local/lib/python2.7/site-packages/urllib3/util/ssl
.py", line 466, in ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock)
File "/usr/local/aws/local/lib/python2.7/site-packages/urllib3/util/ssl
.py", line 166, in wrap_socket
return wrap_socket(socket, ciphers=self.ciphers, **kwargs)
NameError: global name 'wrap_socket' is not defined
2020-11-12 19:24:19,415 - MainThread - botocore.hooks - DEBUG - Event needs-retry.dynamodb.ListTables: calling handler <botocore.retryhandler.RetryHandler object at 0x7f2a37d07b10>
2020-11-12 19:24:19,415 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
File "/usr/local/aws/local/lib/python2.7/site-packages/awscli/clidriver.py", line 217, in main
return command_table[parsed_args.command](remaining, parsed_args)
File "/usr/local/aws/local/lib/python2.7/site-packages/awscli/clidriver.py", line 358, in call
return command_table[parsed_args.operation](remaining, parsed_globals)
File "/usr/local/aws/local/lib/python2.7/site-packages/awscli/clidriver.py", line 530, in call
call_parameters, parsed_globals)
File "/usr/local/aws/local/lib/python2.7/site-packages/awscli/clidriver.py", line 651, in invoke
self._display_response(operation_name, response, parsed_globals)
File "/usr/local/aws/local/lib/python2.7/site-packages/awscli/clidriver.py", line 671, in _display_response
formatter(command_name, response)
File "/usr/local/aws/local/lib/python2.7/site-packages/awscli/formatter.py", line 69, in call
response_data = response.build_full_result()
File "/usr/local/aws/local/lib/python2.7/site-packages/botocore/paginate.py", line 449, in build_full_result
for response in self:
File "/usr/local/aws/local/lib/python2.7/site-packages/botocore/paginate.py", line 255, in iter
response = self._make_request(current_kwargs)
File "/usr/local/aws/local/lib/python2.7/site-packages/botocore/paginate.py", line 332, in _make_request
return self._method(**current_kwargs)
File "/usr/local/aws/local/lib/python2.7/site-packages/botocore/client.py", line 357, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/local/aws/local/lib/python2.7/site-packages/botocore/client.py", line 663, in _make_api_call
operation_model, request_dict, request_context)
File "/usr/local/aws/local/lib/python2.7/site-packages/botocore/client.py", line 682, in _make_request
return self._endpoint.make_request(operation_model, request_dict)
File "/usr/local/aws/local/lib/python2.7/site-packages/botocore/endpoint.py", line 102, in make_request
return self._send_request(request_dict, operation_model)
File "/usr/local/aws/local/lib/python2.7/site-packages/botocore/endpoint.py", line 137, in _send_request
success_response, exception):
File "/usr/local/aws/local/lib/python2.7/site-packages/botocore/endpoint.py", line 256, in _needs_retry
caught_exception=caught_exception, request_dict=request_dict)
File "/usr/local/aws/local/lib/python2.7/site-packages/botocore/hooks.py", line 356, in emit
return self._emitter.emit(aliased_event_name, **kwargs)
File "/usr/local/aws/local/lib/python2.7/site-packages/botocore/hooks.py", line 228, in emit
return self._emit(event_name, kwargs)
File "/usr/local/aws/local/lib/python2.7/site-packages/botocore/hooks.py", line 211, in _emit
response = handler(**kwargs)
File "/usr/local/aws/local/lib/python2.7/site-packages/botocore/retryhandler.py", line 183, in call
if self._checker(attempts, response, caught_exception):
File "/usr/local/aws/local/lib/python2.7/site-packages/botocore/retryhandler.py", line 251, in call
caught_exception)
File "/usr/local/aws/local/lib/python2.7/site-packages/botocore/retryhandler.py", line 269, in _should_retry
return self._checker(attempt_number, response, caught_exception)
File "/usr/local/aws/local/lib/python2.7/site-packages/botocore/retryhandler.py", line 317, in call
caught_exception)
File "/usr/local/aws/local/lib/python2.7/site-packages/botocore/retryhandler.py", line 223, in call
attempt_number, caught_exception)
File "/usr/local/aws/local/lib/python2.7/site-packages/botocore/retryhandler.py", line 359, in _check_caught_exception
raise caught_exception
HTTPClientError: An HTTP Client raised an unhandled exception: global name 'wrap_socket' is not defined
2020-11-12 19:24:19,416 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255

An HTTP Client raised an unhandled exception: global name 'wrap_socket' is not defined

Additional context
Add any other context about the problem here.

@yaodingyd yaodingyd added the needs-triage This issue or PR still needs to be triaged. label Nov 12, 2020
@nateprewitt
Copy link
Member

nateprewitt commented Nov 12, 2020

Hi @yaodingyd, it looks like you're using Python 2.7.6 which doesn't provide proper SSL security. Those features were backported to Python 2.7 in 2.7.9. Did you recently upgrade to urllib3 1.26.0+? This may be a regression in how they're treating old versions of Python 2.7.

@yaodingyd
Copy link
Author

@nateprewitt First thank you for fast response! My build is running in circleci so I've no idea if urllib3 is upgraded or not. Let me dig a bit more on that.

One interesting note is on the same environment I run, v1.18.175 works totally fine.

@yaodingyd
Copy link
Author

create a ticket in urllib3 urllib3/urllib3#2051

@nateprewitt nateprewitt added dependencies This issue is a problem in a dependency. and removed needs-triage This issue or PR still needs to be triaged. labels Nov 12, 2020
@nateprewitt
Copy link
Member

urllib3/urllib3#2052 should be in the next urllib3 release which should resolve this.

@sethmlarson
Copy link

urllib3 1.26.2 has been released which addresses this regression: https://github.com/urllib3/urllib3/releases/tag/1.26.2

@nateprewitt
Copy link
Member

Thanks again, @sethmlarson! Resolving now that there's a fix available on pypi.

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

@yaodingyd
Copy link
Author

thanks guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies This issue is a problem in a dependency.
Projects
None yet
Development

No branches or pull requests

3 participants