Uninett / zinolib

Python library for zino
Apache License 2.0
1 stars 3 forks source link

Bug: uncaught exception in get_log_for_id/parse_response #36

Closed hmpf closed 8 months ago

hmpf commented 10 months ago
Traceback (most recent call last):                                                 
  File "/VENV/howitz/lib/python3.10/site-packages/flask/app.py", line 2213, in __call__
    return self.wsgi_app(environ, start_response)                                  
  File "/VENV/howitz/lib/python3.10/site-packages/flask/app.py", line 2193, in wsgi_app
    response = self.handle_exception(e)                                            
  File "/VENV/howitz/lib/python3.10/site-packages/flask/app.py", line 2190, in wsgi_app
    response = self.full_dispatch_request()                                        
  File "/VENV/howitz/lib/python3.10/site-packages/flask/app.py", line 1486, in full_dispatch+++_request
    rv = self.handle_user_exception(e)                                             
  File "/VENV/howitz/lib/python3.10/site-packages/flask/app.py", line 1484, in full_dispatch+++_request
    rv = self.dispatch_request()                                                   
  File "/VENV/howitz/lib/python3.10/site-packages/flask/app.py", line 1469, in dispatch_requ+++est
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)       
  File "/../howitz/src/howitz/endpoints.py", line 328, in expand_event_row         
    event_attr, event_logs, event_history, event_msgs = get_event_details(event_id)
  File "/../howitz/src/howitz/endpoints.py", line 214, in get_event_details        
    event_logs = current_app.event_manager.get_log_for_id(int(id))                 
  File "/../zinolib/src/zinolib/controllers/zino1.py", line 504, in get_log_for_id
    parsed_log = self._log_adapter.parse_response(raw_log)                         
  File "/../zinolib/src/zinolib/controllers/zino1.py", line 380, in parse_response          
    dt = convert_timestamp(int(timestamp))                                         
ValueError: invalid literal for int() with base 10: 'state:'         

See also #35

hmpf commented 8 months ago

Waiting for it to happen again (with better logging.)

Needs a (semi-)permanent deployment that saves the logs.

hmpf commented 8 months ago

With the help of zinolib.utils.log_exception_with_params:

2024-01-24 11:51:36,941 ERROR zinolib.controllers.zino1 /../zinolib/src/zinolib/utils.py:78:: "parse_response" failed with: args=(['state: waiting', 'router: ifi2-gw5', 'descr: UN000165, ifi2-hmg9, hmg9-gw1', 'type: portstate', 'opened: 1705922434', 'flapstate: stable', 'lasttrans: 1705928245', 'id: 166312', 'port: et-0/1/6', 'flaps: 1', 'updated: 170 5928363', 'ac-down: 27', 'priority: 100', 'polladdr: 128.39.0.146', 'portstate: up', 'ifindex: 719'],) kwargs={}
invalid literal for int() with base 10: 'state:'
Traceback (most recent call last):
  File "/../zinolib/src/zinolib/utils.py", line 73, in wrapper
    result = function(*args, **kwargs)
  File "/../zinolib/src/zinolib/controllers/zino1.py", line 400, in parse_response
    dt = convert_timestamp(int(timestamp))
ValueError: invalid literal for int() with base 10: 'state:'