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

[21.01] Improve feedback for remote file listing exceptions. #11581

Merged
merged 1 commit into from
Mar 10, 2021

Conversation

jmchilton
Copy link
Member

@jmchilton jmchilton commented Mar 9, 2021

What did you do?

  • Added more verbose exception handling and more correct status code exception handling to the remote files API endpoint.

Why did you make this change?

Proposing an alternative to part of #11580.

How to test the changes?

  • Instructions for manual testing are as follows:
    1. See notes from @abretaud below about how he tested this.

@abretaud
Copy link
Contributor

abretaud commented Mar 9, 2021

Ok, tested ✔️ (I played with /etc/hosts while galaxy was listing remote content)

It looks good I think:
image

And got this in the server logs:

Traceback (most recent call last):
  File "/opt/galaxy_dev/galaxy-dist/.venv/lib/python3.6/site-packages/urllib3/connection.py", line 160, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw
  File "/opt/galaxy_dev/galaxy-dist/.venv/lib/python3.6/site-packages/urllib3/util/connection.py", line 84, in create_connection
    raise err
  File "/opt/galaxy_dev/galaxy-dist/.venv/lib/python3.6/site-packages/urllib3/util/connection.py", line 74, in create_connection
    sock.connect(sa)
TimeoutError: [Errno 110] Connection timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/galaxy_dev/galaxy-dist/.venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 677, in urlopen
    chunked=chunked,
  File "/opt/galaxy_dev/galaxy-dist/.venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 381, in _make_request
    self._validate_conn(conn)
  File "/opt/galaxy_dev/galaxy-dist/.venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 978, in _validate_conn
    conn.connect()
  File "/opt/galaxy_dev/galaxy-dist/.venv/lib/python3.6/site-packages/urllib3/connection.py", line 309, in connect
    conn = self._new_conn()
  File "/opt/galaxy_dev/galaxy-dist/.venv/lib/python3.6/site-packages/urllib3/connection.py", line 172, in _new_conn
    self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f84cb22ad30>: Failed to establish a new connection: [Errno 110] Connection timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/galaxy_dev/galaxy-dist/.venv/lib/python3.6/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/opt/galaxy_dev/galaxy-dist/.venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 727, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/opt/galaxy_dev/galaxy-dist/.venv/lib/python3.6/site-packages/urllib3/util/retry.py", line 446, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='data-access.cesgo.org', port=443): Max retries exceeded with url: //remote.php/webdav/foobar.pdf (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f84cb22ad30>: Failed to establish a new connection: [Errno 110] Connection timed out',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/galaxy_dev/galaxy-dist/.venv/lib/python3.6/site-packages/webdav2/client.py", line 58, in _wrapper
    res = fn(self, *args, **kw)
  File "/opt/galaxy_dev/galaxy-dist/.venv/lib/python3.6/site-packages/webdav2/client.py", line 626, in info
    headers=self.get_header('info')
  File "/opt/galaxy_dev/galaxy-dist/.venv/lib/python3.6/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/opt/galaxy_dev/galaxy-dist/.venv/lib/python3.6/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/opt/galaxy_dev/galaxy-dist/.venv/lib/python3.6/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/opt/galaxy_dev/galaxy-dist/.venv/lib/python3.6/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='data-access.cesgo.org', port=443): Max retries exceeded with url: //remote.php/webdav/foobar.pdf (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f84cb22ad30>: Failed to establish a new connection: [Errno 110] Connection timed out',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "lib/galaxy/webapps/galaxy/api/remote_files.py", line 72, in index
    index = file_source.list(file_source_path.path, recursive=recursive, user_context=user_context)
  File "lib/galaxy/files/sources/_pyfilesystem2.py", line 39, in list
    return list(map(to_dict, res))
  File "/opt/galaxy_dev/galaxy-dist/.venv/lib/python3.6/site-packages/fs/base.py", line 1266, in <genexpr>
    for name in self.listdir(path)
  File "/opt/galaxy_dev/galaxy-dist/.venv/lib/python3.6/site-packages/webdavfs/webdavfs.py", line 248, in getinfo
    info = self.client.info(_path.encode('utf-8'))
  File "/opt/galaxy_dev/galaxy-dist/.venv/lib/python3.6/site-packages/webdav2/client.py", line 60, in _wrapper
    raise NotConnection(self.webdav.hostname)
webdav2.exceptions.NotConnection: Not connection with https://data-access.cesgo.org/

@jmchilton jmchilton changed the title [21.01][WIP] Bug fix - poor feedback for remote file listing exceptions. [21.01] Bug fix - poor feedback for remote file listing exceptions. Mar 9, 2021
@mvdbeek mvdbeek changed the title [21.01] Bug fix - poor feedback for remote file listing exceptions. [21.01] Improve feedback for remote file listing exceptions. Mar 10, 2021
@mvdbeek mvdbeek merged commit 90e4f0c into galaxyproject:release_21.01 Mar 10, 2021
@mvdbeek mvdbeek added this to the 21.01 milestone Mar 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants