MSS icon indicating copy to clipboard operation
MSS copied to clipboard

switching locally network off gives a traceback for msui/msc

Open ReimarBauer opened this issue 2 years ago • 3 comments

.When we enabled mscolab_skip_verify_user_token, which means we check not if the server connection is alive on any request we can get on selecting an other operation.

Fatal error in MSS 7.0.6. on Linux-5.4.0-135-generic-x86_64-with-glibc2.27
Python 3.9.13 | packaged by conda-forge | (main, May 27 2022, 16:58:50) 
[GCC 10.3.0]

Please report bugs in MSS to https://github.com/Open-MSS/MSS

Information about the fatal error:

Traceback (most recent call last):
  File "/home/reimar/miniconda3/envs/mssdev/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
  File "/home/reimar/miniconda3/envs/mssdev/lib/python3.9/site-packages/urllib3/util/connection.py", line 72, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/home/reimar/miniconda3/envs/mssdev/lib/python3.9/socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Der Name oder der Dienst ist nicht bekannt

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/reimar/miniconda3/envs/mssdev/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/home/reimar/miniconda3/envs/mssdev/lib/python3.9/site-packages/urllib3/connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "/home/reimar/miniconda3/envs/mssdev/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn
    conn.connect()
  File "/home/reimar/miniconda3/envs/mssdev/lib/python3.9/site-packages/urllib3/connection.py", line 358, in connect
    self.sock = conn = self._new_conn()
  File "/home/reimar/miniconda3/envs/mssdev/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f22e4a9a340>: Failed to establish a new connection: [Errno -2] Der Name oder der Dienst ist nicht bekannt

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/reimar/miniconda3/envs/mssdev/lib/python3.9/site-packages/requests/adapters.py", line 489, in send
    resp = conn.urlopen(
  File "/home/reimar/miniconda3/envs/mssdev/lib/python3.9/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    retries = retries.increment(
  File "/home/reimar/miniconda3/envs/mssdev/lib/python3.9/site-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='forecast.fz-juelich.de', port=443): Max retries exceeded with url: /set_last_used (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f22e4a9a340>: Failed to establish a new connection: [Errno -2] Der Name oder der Dienst ist nicht bekannt'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/reimar/MASTER/MSS/mslib/msui/mscolab.py", line 1545, in set_active_op_id
    requests.post(f'{self.mscolab_server_url}/set_last_used', data=data, timeout=(2, 10))
  File "/home/reimar/miniconda3/envs/mssdev/lib/python3.9/site-packages/requests/api.py", line 115, in post
    return request("post", url, data=data, json=json, **kwargs)
  File "/home/reimar/miniconda3/envs/mssdev/lib/python3.9/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/reimar/miniconda3/envs/mssdev/lib/python3.9/site-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/reimar/miniconda3/envs/mssdev/lib/python3.9/site-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "/home/reimar/miniconda3/envs/mssdev/lib/python3.9/site-packages/requests/adapters.py", line 565, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='forecast.fz-juelich.de', port=443): Max retries exceeded with url: /set_last_used (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f22e4a9a340>: Failed to establish a new connection: [Errno -2] Der Name oder der Dienst ist nicht bekannt'))

ReimarBauer avatar Dec 07 '22 17:12 ReimarBauer

When in a given timespan the connection returns the program does continue, so we have only to catch this and inform the user.

ReimarBauer avatar Dec 07 '22 17:12 ReimarBauer

when the check is enabled also the error occures but there is no timespan for a reconnection because the user has to relogin.

ReimarBauer avatar Dec 07 '22 18:12 ReimarBauer

This is by design.

We have two states. When there is an uncertain known internet connection then disable mscolab_skip_verify_user_token. By this any action will be verified on the server. The interaction is delayed by these requests.

The default is set for a good internet connection. In case of a short interruption, all information is sent at the moment when the connection is re-established. It retries to send.

The crash happens when that max retries is exceeded or when another pull of data from the server is introduced. A better solution needs a redesign.

ReimarBauer avatar Feb 28 '23 19:02 ReimarBauer

reopen when happens again

ReimarBauer avatar Nov 29 '24 13:11 ReimarBauer