Open feiyushi opened 4 years ago
hi @arrownj could you pls have a look? thanks.
Hi @feiyushi , this is a very low level exception which is raised by urllib3
. Usually it is because that there are some physical problems which cause the failure of socket connection setup.
It's a good idea to catch the ConnetionError
and show a common message to end users. We will consider to add this in our future release. Thanks for reporting.
@feiyushi any update?
@feiyushi any update?
hi @yonzhan I don't think there's any action items for me and I'm the user reporting the bug. Maybe @arrownj have some idea how to improve it.
Hi @houk-ms , can we handle such exception in a general way in the future ?
@arrownj yes, we can. I think it's better we get #14855 merged first, and then come back to handle this error.
hi @arrownj @houk-ms any update on the issue? thanks
hi @arrownj @houk-ms any update?
Describe the bug It failed when getting access token:
az account get-access-token --q accessToken -o tsv
If it fails by design, is it possible to fail elegantly?('Connection aborted.', OSError("(104, 'ECONNRESET')",)) Traceback (most recent call last): File "/opt/az/lib/python3.6/site-packages/urllib3/connectionpool.py", line 603, in urlopen chunked=chunked) File "/opt/az/lib/python3.6/site-packages/urllib3/connectionpool.py", line 387, in _make_request six.raise_from(e, None) File "", line 2, in raise_from
File "/opt/az/lib/python3.6/site-packages/urllib3/connectionpool.py", line 383, in _make_request
httplib_response = conn.getresponse()
File "/opt/az/lib/python3.6/http/client.py", line 1331, in getresponse
response.begin()
File "/opt/az/lib/python3.6/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/opt/az/lib/python3.6/http/client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/opt/az/lib/python3.6/socket.py", line 586, in readinto
return self._sock.recv_into(b)
File "/opt/az/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 309, in recv_into
raise SocketError(str(e))
OSError: (104, 'ECONNRESET')
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/opt/az/lib/python3.6/site-packages/requests/adapters.py", line 449, in send timeout=timeout File "/opt/az/lib/python3.6/site-packages/urllib3/connectionpool.py", line 641, in urlopen _stacktrace=sys.exc_info()[2]) File "/opt/az/lib/python3.6/site-packages/urllib3/util/retry.py", line 368, in increment raise six.reraise(type(error), error, _stacktrace) File "/opt/az/lib/python3.6/site-packages/urllib3/packages/six.py", line 685, in reraise raise value.with_traceback(tb) File "/opt/az/lib/python3.6/site-packages/urllib3/connectionpool.py", line 603, in urlopen chunked=chunked) File "/opt/az/lib/python3.6/site-packages/urllib3/connectionpool.py", line 387, in _make_request six.raise_from(e, None) File "", line 2, in raise_from
File "/opt/az/lib/python3.6/site-packages/urllib3/connectionpool.py", line 383, in _make_request
httplib_response = conn.getresponse()
File "/opt/az/lib/python3.6/http/client.py", line 1331, in getresponse
response.begin()
File "/opt/az/lib/python3.6/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/opt/az/lib/python3.6/http/client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/opt/az/lib/python3.6/socket.py", line 586, in readinto
return self._sock.recv_into(b)
File "/opt/az/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 309, in recv_into
raise SocketError(str(e))
urllib3.exceptions.ProtocolError: ('Connection aborted.', OSError("(104, 'ECONNRESET')",))
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 215, in invoke cmd_result = self.invocation.execute(args) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 654, in execute raise ex File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 718, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 711, in _run_job six.reraise(sys.exc_info()) File "/opt/az/lib/python3.6/site-packages/six.py", line 703, in reraise raise value File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 688, in _run_job result = cmd_copy(params) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 325, in call return self.handler(args, kwargs) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/init.py", line 545, in default_command_handler return op(command_args) File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/profile/custom.py", line 75, in get_access_token creds, subscription, tenant = profile.get_raw_token(subscription=subscription, resource=resource, tenant=tenant) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/_profile.py", line 655, in get_raw_token tenant_dest) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/_profile.py", line 1056, in retrieve_token_for_service_principal token_entry = sp_auth.acquire_token(context, resource, sp_id) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/_profile.py", line 1156, in acquire_token return authentication_context.acquire_token_with_client_credentials(resource, client_id, self.secret) File "/opt/az/lib/python3.6/site-packages/adal/authentication_context.py", line 179, in acquire_token_with_client_credentials return self._acquire_token(token_func) File "/opt/az/lib/python3.6/site-packages/adal/authentication_context.py", line 128, in _acquire_token return token_func(self) File "/opt/az/lib/python3.6/site-packages/adal/authentication_context.py", line 177, in token_func return token_request.get_token_with_client_credentials(client_secret) File "/opt/az/lib/python3.6/site-packages/adal/token_request.py", line 310, in get_token_with_client_credentials token = self._oauth_get_token(oauth_parameters) File "/opt/az/lib/python3.6/site-packages/adal/token_request.py", line 112, in _oauth_get_token return client.get_token(oauth_parameters) File "/opt/az/lib/python3.6/site-packages/adal/oauth2_client.py", line 268, in get_token timeout=self._call_context.get('timeout', None)) File "/opt/az/lib/python3.6/site-packages/requests/api.py", line 116, in post return request('post', url, data=data, json=json, kwargs) File "/opt/az/lib/python3.6/site-packages/requests/api.py", line 60, in request return session.request(method=method, url=url, kwargs) File "/opt/az/lib/python3.6/site-packages/requests/sessions.py", line 533, in request resp = self.send(prep, send_kwargs) File "/opt/az/lib/python3.6/site-packages/requests/sessions.py", line 646, in send r = adapter.send(request, kwargs) File "/opt/az/lib/python3.6/site-packages/requests/adapters.py", line 498, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', OSError("(104, 'ECONNRESET')",)) To Reproduce
Expected behavior
Environment summary
az version
is 2.5.1 Additional context