HumanBrainProject / hbp-validation-client

A Python package for working with the Human Brain Project Model Validation Framework
http://hbp-validation-client.readthedocs.io
BSD 3-Clause "New" or "Revised" License
2 stars 3 forks source link

Frequent authentication issue: RemoteDisconnected #92

Open appukuttan-shailesh opened 3 years ago

appukuttan-shailesh commented 3 years ago

The following error comes up very frequently (I think it is every time a new token is freshly issued): (this issue has existed for some months now....)

e.g.

mc = ModelCatalog(HBP_USERNAME)
model_data = mc.get_model(.......) <- ERROR

The error disappears on re-running the same cell without any changes.

Error:

RemoteDisconnected Traceback (most recent call last) ~/.virtualenvs/py3env/lib/python3.6/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) 676 headers=headers, --> 677 chunked=chunked, 678 )

~/.virtualenvs/py3env/lib/python3.6/site-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw) 425 # Otherwise it looks like a bug in the code. --> 426 six.raise_from(e, None) 427 except (SocketTimeout, BaseSSLError, SocketError) as e:

~/.virtualenvs/py3env/lib/python3.6/site-packages/urllib3/packages/six.py in raise_from(value, from_value)

~/.virtualenvs/py3env/lib/python3.6/site-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw) 420 try: --> 421 httplib_response = conn.getresponse() 422 except BaseException as e:

/usr/lib/python3.6/http/client.py in getresponse(self) 1372 try: -> 1373 response.begin() 1374 except ConnectionError:

/usr/lib/python3.6/http/client.py in begin(self) 310 while True: --> 311 version, status, reason = self._read_status() 312 if status != CONTINUE:

/usr/lib/python3.6/http/client.py in _read_status(self) 279 # sending a valid response. --> 280 raise RemoteDisconnected("Remote end closed connection without" 281 " response")

RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

ProtocolError Traceback (most recent call last) ~/.virtualenvs/py3env/lib/python3.6/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies) 448 retries=self.max_retries, --> 449 timeout=timeout 450 )

~/.virtualenvs/py3env/lib/python3.6/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) 724 retries = retries.increment( --> 725 method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] 726 )

~/.virtualenvs/py3env/lib/python3.6/site-packages/urllib3/util/retry.py in increment(self, method, url, response, error, _pool, _stacktrace) 402 if read is False or not self._is_method_retryable(method): --> 403 raise six.reraise(type(error), error, _stacktrace) 404 elif read is not None:

~/.virtualenvs/py3env/lib/python3.6/site-packages/urllib3/packages/six.py in reraise(tp, value, tb) 733 if value.traceback is not tb: --> 734 raise value.with_traceback(tb) 735 raise value

~/.virtualenvs/py3env/lib/python3.6/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) 676 headers=headers, --> 677 chunked=chunked, 678 )

~/.virtualenvs/py3env/lib/python3.6/site-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw) 425 # Otherwise it looks like a bug in the code. --> 426 six.raise_from(e, None) 427 except (SocketTimeout, BaseSSLError, SocketError) as e:

~/.virtualenvs/py3env/lib/python3.6/site-packages/urllib3/packages/six.py in raise_from(value, from_value)

~/.virtualenvs/py3env/lib/python3.6/site-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw) 420 try: --> 421 httplib_response = conn.getresponse() 422 except BaseException as e:

/usr/lib/python3.6/http/client.py in getresponse(self) 1372 try: -> 1373 response.begin() 1374 except ConnectionError:

/usr/lib/python3.6/http/client.py in begin(self) 310 while True: --> 311 version, status, reason = self._read_status() 312 if status != CONTINUE:

/usr/lib/python3.6/http/client.py in _read_status(self) 279 # sending a valid response. --> 280 raise RemoteDisconnected("Remote end closed connection without" 281 " response")

ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))

During handling of the above exception, another exception occurred:

ConnectionError Traceback (most recent call last)

in ----> 1 model_data = mc.get_model(alias=model_alias) ~/.virtualenvs/py3env/lib/python3.6/site-packages/hbp_validation_framework/__init__.py in get_model(self, model_id, alias, instances, images) 1580 url = self.url + "/models/" + quote(alias) 1581 -> 1582 model_json = requests.get(url, auth=self.auth, verify=self.verify) 1583 if model_json.status_code != 200: 1584 handle_response_error("Error in retrieving model", model_json) ~/.virtualenvs/py3env/lib/python3.6/site-packages/requests/api.py in get(url, params, **kwargs) 74 75 kwargs.setdefault('allow_redirects', True) ---> 76 return request('get', url, params=params, **kwargs) 77 78 ~/.virtualenvs/py3env/lib/python3.6/site-packages/requests/api.py in request(method, url, **kwargs) 59 # cases, and look like a memory leak in others. 60 with sessions.Session() as session: ---> 61 return session.request(method=method, url=url, **kwargs) 62 63 ~/.virtualenvs/py3env/lib/python3.6/site-packages/requests/sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json) 528 } 529 send_kwargs.update(settings) --> 530 resp = self.send(prep, **send_kwargs) 531 532 return resp ~/.virtualenvs/py3env/lib/python3.6/site-packages/requests/sessions.py in send(self, request, **kwargs) 641 642 # Send the request --> 643 r = adapter.send(request, **kwargs) 644 645 # Total elapsed time of the request (approximately) ~/.virtualenvs/py3env/lib/python3.6/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies) 496 497 except (ProtocolError, socket.error) as err: --> 498 raise ConnectionError(err, request=request) 499 500 except MaxRetryError as e: ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',)) ```
appukuttan-shailesh commented 3 years ago

@apdavison : this issue still persists, and is particularly problematic when trying to run scripts on HPCs (owing to lack of scope for manual intervention).