Project

General

Profile

Actions

Bug #7738

closed

Error in reports blueprint when page is not a valid number

Added by Rajmund Hruška about 1 month ago. Updated 13 days ago.

Status:
Closed
Priority:
Normal
Category:
Development - GUI
Target version:
Start date:
05/14/2024
Due date:
% Done:

0%

Estimated time:
To be discussed:
No

Description

Might be an issue in other places where pagination is used.

Message type: CRITICAL
Location:     /var/mentat/venv/lib/python3.11/site-packages/hawat/base.py:202
Module:       base
Function:     eh_internal_server_error
Time:         2024-05-14 20:09:31,613

Message:

INTERNAL SERVER ERROR

Request: /reports/search?label=&dt_from=2024-05-07+21:00&dt_to=2024-05-14+21:00&submit=Search&page=2d
Traceback:
Traceback (most recent call last):
  File "/var/mentat/venv/lib/python3.11/site-packages/flask/app.py", line 2529, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/flask/app.py", line 1825, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/flask/app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/flask_login/utils.py", line 290, in decorated_view
    return current_app.ensure_sync(func)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/flask/views.py", line 107, in view
    return current_app.ensure_sync(self.dispatch_request)(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/hawat/view/__init__.py", line 872, in dispatch_request
    form = self.get_search_form(flask.request.args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/hawat/blueprints/reports/__init__.py", line 130, in get_search_form
    return EventReportSearchForm(request_args, meta={'csrf': False})
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/wtforms/form.py", line 208, in __call__
    return type.__call__(cls, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/flask_wtf/form.py", line 73, in __init__
    super().__init__(formdata=formdata, **kwargs)
  File "/var/mentat/venv/lib/python3.11/site-packages/wtforms/form.py", line 286, in __init__
    self.process(formdata, obj, data=data, **kwargs)
  File "/var/mentat/venv/lib/python3.11/site-packages/wtforms/form.py", line 127, in process
    field.process(formdata, data, extra_filters=field_extra_filters)
  File "/var/mentat/venv/lib/python3.11/site-packages/wtforms/fields/core.py", line 338, in process
    self.data = filter(self.data)
                ^^^^^^^^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

Actions #1

Updated by Rajmund Hruška about 1 month ago

We have encountered the same error 2 weeks ago in /api/events.


Message type: CRITICAL
Location:     /var/mentat/venv/lib/python3.11/site-packages/hawat/base.py:202
Module:       base
Function:     eh_internal_server_error
Time:         2024-05-02 12:45:20,068

Message:

INTERNAL SERVER ERROR

Request: /api/events/search?dt_from=2024-04-30+13:00:00&dt_to=2024-05-02+12:45:00&source_addrs=&source_ports=&not_groups=&not_protocols=&description=&not_categories=&not_severities=&detectors=&not_detectors=&not_detector_types=&submit=Search&limit=50000&page=&sortby=time.asc
Traceback:
Traceback (most recent call last):
  File "/var/mentat/venv/lib/python3.11/site-packages/flask/app.py", line 2529, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/flask/app.py", line 1825, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/flask/app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/flask_login/utils.py", line 290, in decorated_view
    return current_app.ensure_sync(func)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/flask/views.py", line 107, in view
    return current_app.ensure_sync(self.dispatch_request)(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/hawat/view/__init__.py", line 872, in dispatch_request
    form = self.get_search_form(flask.request.args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/hawat/blueprints/events/__init__.py", line 97, in get_search_form
    return _get_search_form(request_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/hawat/blueprints/events/__init__.py", line 52, in _get_search_form
    form = SimpleEventSearchForm(
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/wtforms/form.py", line 208, in __call__
    return type.__call__(cls, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/hawat/blueprints/events/forms.py", line 344, in __init__
    super().__init__(*args, **kwargs)
  File "/var/mentat/venv/lib/python3.11/site-packages/flask_wtf/form.py", line 73, in __init__
    super().__init__(formdata=formdata, **kwargs)
  File "/var/mentat/venv/lib/python3.11/site-packages/wtforms/form.py", line 286, in __init__
    self.process(formdata, obj, data=data, **kwargs)
  File "/var/mentat/venv/lib/python3.11/site-packages/wtforms/form.py", line 127, in process
    field.process(formdata, data, extra_filters=field_extra_filters)
  File "/var/mentat/venv/lib/python3.11/site-packages/wtforms/fields/core.py", line 338, in process
    self.data = filter(self.data)
                ^^^^^^^^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

Actions #2

Updated by Rajmund Hruška about 1 month ago

  • Status changed from New to In Progress
  • Assignee set to Rajmund Hruška
Actions #3

Updated by Rajmund Hruška about 1 month ago

This is also related:

Message type: CRITICAL
Location:     /var/mentat/venv/lib/python3.11/site-packages/hawat/base.py:202
Module:       base
Function:     eh_internal_server_error
Time:         2024-05-23 15:57:09,184

Message:

INTERNAL SERVER ERROR

Request: /events/search?dt_from=2024-05-16+16:00:00&dt_to=2024-05-23+16:00:00&source_addrs=&source_ports=&submit=Search&page=2247742924353535323525
Traceback:
Traceback (most recent call last):
  File "/var/mentat/venv/lib/python3.11/site-packages/mentat/services/eventstorage.py", line 1053, in exc_handle_wrapper
    return func(self, *args, **kwargs)  # pylint: disable=locally-disabled,not-callable
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/mentat/services/eventstorage.py", line 1440, in search_events
    count, result = self.cursor.search_events(parameters, qtype = qtype, qname = qname)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/mentat/services/eventstorage.py", line 761, in search_events
    self.cursor.execute(query, params)
  File "/var/mentat/venv/lib/python3.11/site-packages/psycopg2/extras.py", line 312, in execute
    return super().execute(query, vars)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
psycopg2.errors.NumericValueOutOfRange: bigint out of range

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/var/mentat/venv/lib/python3.11/site-packages/flask/app.py", line 2529, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/flask/app.py", line 1825, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/flask/app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/flask_login/utils.py", line 290, in decorated_view
    return current_app.ensure_sync(func)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/flask/views.py", line 107, in view
    return current_app.ensure_sync(self.dispatch_request)(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/hawat/view/__init__.py", line 903, in dispatch_request
    items = self.search(form_data)
            ^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/hawat/base.py", line 1348, in search
    items_count_total, items = self.get_db().search_events(
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/mentat/services/eventstorage.py", line 1017, in wrapped_f
    return func(other_self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/mentat/venv/lib/python3.11/site-packages/mentat/services/eventstorage.py", line 1061, in exc_handle_wrapper
    raise DataError(str(err)) from err
mentat.services.eventstorage.DataError: bigint out of range
Actions #4

Updated by Rajmund Hruška about 1 month ago

  • Status changed from In Progress to Resolved
Actions #5

Updated by Jakub Judiny 28 days ago

  • Status changed from Resolved to In Progress
Actions #6

Updated by Jakub Judiny 21 days ago

  • Status changed from In Progress to Resolved
Actions #7

Updated by Rajmund Hruška 19 days ago

  • Status changed from Resolved to In Review
Actions #8

Updated by Rajmund Hruška 13 days ago

  • Status changed from In Review to Closed
Actions

Also available in: Atom PDF