jorgebastida / jorgebastida/awslogs

Failed to establish a new connection

Open
#276 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
5k
Forks
342
PR merge metrics
No merged PRs in 30d

Description

I got this error while using awslogs:

You've found a bug! Please, raise an issue attaching the following traceback
https://github.com/jorgebastida/awslogs/issues/new

```Version: 0.11.0
Python: 3.7.3 (default, Mar 27 2019, 09:23:15)
[Clang 10.0.1 (clang-1001.0.46.3)]
boto3 version: 1.9.109
Platform: Darwin-18.7.0-x86_64-i386-64bit
Config: {'aws_access_key_id': 'SENSITIVE', 'aws_secret_access_key': 'SENSITIVE', 'aws_session_token': 'SENSITIVE', 'aws_profile': 'SENSITIVE', 'aws_region': None, 'log_group_name': '/staging/ecs/embulk', 'log_stream_name': 'ALL', 'filter_pattern': None, 'watch': True, 'watch_interval': 1, 'output_group_enabled': True, 'output_stream_enabled': True, 'output_timestamp_enabled': False, 'output_ingestion_time_enabled': False, 'start': '5m', 'end': None, 'color': 'auto', 'query': None, 'func': 'list_logs'}
Args: ['/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/bin/awslogs', 'get', '/staging/ecs/embulk', '-w']

Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 159, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 57, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socket.py", line 748, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/piotrwilkowski/Library/Python/3.7/lib/python/site-packages/botocore/httpsession.py", line 258, in send
decode_content=False,
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 343, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/local/lib/python3.7/site-packages/urllib3/packages/six.py", line 686, in reraise
raise value
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 343, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 839, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 301, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 168, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/awslogs/bin.py", line 178, in main
getattr(logs, options.func)()
File "/usr/local/lib/python3.7/site-packages/awslogs/core.py", line 223, in list_logs
consumer()
File "/usr/local/lib/python3.7/site-packages/awslogs/core.py", line 164, in consumer
for event in generator():
File "/usr/local/lib/python3.7/site-packages/awslogs/core.py", line 151, in generator
response = self.client.filter_log_events(**kwargs)
File "/Users/piotrwilkowski/Library/Python/3.7/lib/python/site-packages/botocore/client.py", line 357, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/Users/piotrwilkowski/Library/Python/3.7/lib/python/site-packages/botocore/client.py", line 648, in _make_api_call
operation_model, request_dict, request_context)
File "/Users/piotrwilkowski/Library/Python/3.7/lib/python/site-packages/botocore/client.py", line 667, in _make_request
return self._endpoint.make_request(operation_model, request_dict)
File "/Users/piotrwilkowski/Library/Python/3.7/lib/python/site-packages/botocore/endpoint.py", line 102, in make_request
return self._send_request(request_dict, operation_model)
File "/Users/piotrwilkowski/Library/Python/3.7/lib/python/site-packages/botocore/endpoint.py", line 137, in _send_request
success_response, exception):
File "/Users/piotrwilkowski/Library/Python/3.7/lib/python/site-packages/botocore/endpoint.py", line 231, in _needs_retry
caught_exception=caught_exception, request_dict=request_dict)
File "/Users/piotrwilkowski/Library/Python/3.7/lib/python/site-packages/botocore/hooks.py", line 356, in emit
return self._emitter.emit(aliased_event_name, **kwargs)
File "/Users/piotrwilkowski/Library/Python/3.7/lib/python/site-packages/botocore/hooks.py", line 228, in emit
return self._emit(event_name, kwargs)
File "/Users/piotrwilkowski/Library/Python/3.7/lib/python/site-packages/botocore/hooks.py", line 211, in _emit
response = handler(**kwargs)
File "/Users/piotrwilkowski/Library/Python/3.7/lib/python/site-packages/botocore/retryhandler.py", line 183, in __call__
if self._checker(attempts, response, caught_exception):
File "/Users/piotrwilkowski/Library/Python/3.7/lib/python/site-packages/botocore/retryhandler.py", line 251, in __call__
caught_exception)
File "/Users/piotrwilkowski/Library/Python/3.7/lib/python/site-packages/botocore/retryhandler.py", line 277, in _should_retry
return self._checker(attempt_number, response, caught_exception)
File "/Users/piotrwilkowski/Library/Python/3.7/lib/python/site-packages/botocore/retryhandler.py", line 317, in __call__
caught_exception)
File "/Users/piotrwilkowski/Library/Python/3.7/lib/python/site-packages/botocore/retryhandler.py", line 223, in __call__
attempt_number, caught_exception)
File "/Users/piotrwilkowski/Library/Python/3.7/lib/python/site-packages/botocore/retryhandler.py", line 359, in _check_caught_exception
raise caught_exception
File "/Users/piotrwilkowski/Library/Python/3.7/lib/python/site-packages/botocore/endpoint.py", line 200, in _do_get_response
http_response = self._send(request)
File "/Users/piotrwilkowski/Library/Python/3.7/lib/python/site-packages/botocore/endpoint.py", line 244, in _send
return self.http_session.send(request)
File "/Users/piotrwilkowski/Library/Python/3.7/lib/python/site-packages/botocore/httpsession.py", line 278, in send
raise EndpointConnectionError(endpoint_url=request.url, error=e)
botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://logs.eu-central-1.amazonaws.com/"

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the awslogs/bin.py main entry point and the awslogs/core.py list_logs and consumer call chain shown in the traceback. Reproduce the reported command and inspect how the AWS endpoint is selected and how this connection error is surfaced; done means a confirmed diagnosis and an appropriate, actionable behavior for the failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
cli, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.