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

Raise better error when EventManager-session and/or UpdateHandler is None #68

Open
podliashanyk opened this issue Jun 24, 2024 · 1 comment
Labels
uncaught exception Subtype of bug

Comments

@podliashanyk
Copy link
Contributor

podliashanyk commented Jun 24, 2024

If connection to Zino server is lost and when client is attempting several requests after that, an AttributeError is raised. One of the errors that more clearly indicates a connection loss should be raised instead. Possibly some extra handling of session becoming None could be needed in zinolib, not sure. Same applies to UpdateHandler when it becomes None after a connection loss.

When session in EventManager is None:

Traceback (most recent call last):
  File "/Users/ilopod/Desktop/zino-dev/Howitz/howitzvenv/lib/python3.10/site-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/ilopod/Desktop/zino-dev/Howitz/howitzvenv/lib/python3.10/site-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/Users/ilopod/Desktop/zino-dev/Howitz/src/howitz/endpoints.py", line 515, in refresh_events
    removed_events, modified_events, added_events, event_list = refresh_current_events()
  File "/Users/ilopod/Desktop/zino-dev/Howitz/src/howitz/endpoints.py", line 217, in refresh_current_events
    event_ids = update_events()
  File "/Users/ilopod/Desktop/zino-dev/Howitz/src/howitz/endpoints.py", line 203, in update_events
    updated = current_app.updater.get_event_update()
  File "/Users/ilopod/Desktop/zino-dev/zinolib/src/zinolib/controllers/zino1.py", line 179, in get_event_update
    self.check_connection()
  File "/Users/ilopod/Desktop/zino-dev/zinolib/src/zinolib/controllers/zino1.py", line 160, in check_connection
    if self.manager.session.push._sock.fileno() >= 0:
AttributeError: 'NoneType' object has no attribute 'push'

When UpdateHandler is None:

Traceback (most recent call last):
  File "/home/howitz/.venv/lib/python3.11/site-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/howitz/.venv/lib/python3.11/site-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/howitz/Howitz/src/howitz/endpoints.py", line 366, in refresh_events
    removed_events, modified_events, added_events = refresh_current_events()
                                                    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/howitz/Howitz/src/howitz/endpoints.py", line 156, in refresh_current_events
    event_ids = update_events()
                ^^^^^^^^^^^^^^^
  File "/home/howitz/Howitz/src/howitz/endpoints.py", line 140, in update_events
    updated = current_app.updater.get_event_update()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_event_update'
@podliashanyk podliashanyk added the uncaught exception Subtype of bug label Jun 24, 2024
@podliashanyk podliashanyk changed the title Raise better error when session is None in EventManager Raise better error when EventManager session and/or UpdateHandler is None Jun 24, 2024
@podliashanyk podliashanyk changed the title Raise better error when EventManager session and/or UpdateHandler is None Raise better error when EventManager-session and/or UpdateHandler is None Jun 24, 2024
@hmpf
Copy link
Contributor

hmpf commented Jul 2, 2024

This means either that the UpdateHandler was never set up correctly, or that the connection was lost, cleaned up, and the reconnect failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
uncaught exception Subtype of bug
Projects
None yet
Development

No branches or pull requests

2 participants