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

Server responds HTTP 500 and doesn't heal if connection to sc-server was lost #18

Open
FallenChromium opened this issue Aug 18, 2022 · 0 comments
Labels
bug Something isn't working user-session

Comments

@FallenChromium
Copy link
Contributor

Describe the bug
The only way to make sc-web work again after it lost connection to sc-server is to restart app.py, connections loss causes an UncaughtException:

[E 220818 11:16:16 web:1798] Uncaught exception GET /api/user/ (172.17.0.1)
    HTTPServerRequest(protocol='http', host='localhost:8000', method='GET', uri='/api/user/', version='HTTP/1.1', remote_ip='172.17.0.1')
    Traceback (most recent call last):
      File "/usr/local/lib/python3.8/dist-packages/tornado/web.py", line 1711, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "/sc-web/server/decorators.py", line 28, in wrapper
        return func(*argv)
      File "/sc-web/server/handlers/api.py", line 389, in get
        user_addr = sc_session.get_sc_addr()
      File "/sc-web/server/decorators.py", line 28, in wrapper
        return func(*argv)
      File "/sc-web/server/handlers/api_logic.py", line 759, in get_sc_addr
        self.sc_addr = self._session_get_sc_addr()
      File "/sc-web/server/handlers/api_logic.py", line 878, in _session_get_sc_addr
        return self._find_user_by_system_idtf("session::" + str(self.session_key))
      File "/sc-web/server/handlers/api_logic.py", line 856, in _find_user_by_system_idtf
        value = client.resolve_keynodes(ScIdtfResolveParams(idtf=idtf, type=None))[0]
      File "/usr/local/lib/python3.8/dist-packages/sc_client/client/_api.py", line 67, in resolve_keynodes
        return session.execute(common.ClientCommand.KEYNODES, *params)
      File "/usr/local/lib/python3.8/dist-packages/sc_client/session.py", line 150, in execute
        return _ScClientSession.executor.run(request_type, *args)
      File "/usr/local/lib/python3.8/dist-packages/sc_client/client/_executor.py", line 29, in run
        response = session.send_message(self._executor_mapper.get(command_type), payload)
      File "/usr/local/lib/python3.8/dist-packages/sc_client/session.py", line 121, in send_message
        raise BrokenPipeError
    BrokenPipeError
[E 220818 11:16:16 web:2271] 500 GET /api/user/ (172.17.0.1) 1.16ms

To Reproduce
Steps to reproduce the behavior:

  1. Start sc-server
  2. Start sc-web
  3. Check that the page works
  4. Restart sc-server
  5. You will get HTTP 500
  6. Page will no longer be able to load properly

Expected behavior
In case the connection to sc-server was lost there should be an attempt to restore it, transparently to the user side. In other words, we should handle the BrokenPipe exception.

Desktop (please complete the following information):

  • OS: macOS 13 Ventura
  • Browser: Chromium
  • Runtime: Docker
@NikitaZotov NikitaZotov added bug Something isn't working user-session labels Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working user-session
Projects
None yet
Development

No branches or pull requests

2 participants