searxng/searx/plugins
Markus Heiser a954b6fce1 [fix] calculator plugin: subrocess is not closed on timeout
The issue was introduced in commit: edfbf1e

Problematic code::

    def timeout_func(timeout, func, *args, **kwargs):
        ...
        if not p.is_alive():
            ret_val = que.get()
        else:
            logger.debug("terminate function after timeout is exceeded")  # type: ignore
            p.terminate()
        p.join()
        p.close()

The `logger` function in the `else` path is not defined.  Was accidentally
removed in commit edfbf1e without providing an appropriate replacement.::

    File "/usr/local/searxng/searx/plugins/calculator.py", line 216, in timeout_func
      logger.debug("terminate function after timeout is exceeded")  # type: ignore
      ^^^^^^
    NameError: name 'logger' is not defined

The exception triggered by this prevents the `p.terminate()` from being
executed. As a result, the processes accumulate in memory (memory leak).

Related: https://github.com/searxng/searx-instances/discussions/708#discussioncomment-13688168
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2025-07-08 08:48:07 +02:00
..
__init__.py [refactor] migrate plugins from "module" to class SXNGPlugin 2025-03-29 10:16:43 +01:00
_core.py [chore] fix some docstring typos (#4815) 2025-05-20 21:03:54 +02:00
ahmia_filter.py [refactor] migrate plugins from "module" to class SXNGPlugin 2025-03-29 10:16:43 +01:00
calculator.py [fix] calculator plugin: subrocess is not closed on timeout 2025-07-08 08:48:07 +02:00
hash_plugin.py [mod] Hash plugin: List the available hash functions in the description 2025-06-12 21:05:49 +02:00
hostnames.py [chore] docs: various grammatical fixes 2025-06-23 23:01:29 +02:00
oa_doi_rewrite.py [refactor] migrate plugins from "module" to class SXNGPlugin 2025-03-29 10:16:43 +01:00
self_info.py [refactor] migrate plugins from "module" to class SXNGPlugin 2025-03-29 10:16:43 +01:00
tor_check.py [enh] plugins: tor_check: Add more keywords (#4726) 2025-05-07 10:39:46 +02:00
tracker_url_remover.py [mod] data: implement a simple tracker URL (SQL) database 2025-06-23 22:12:18 +02:00
unit_converter.py [mod] weather results: add types, i18n/l10n, symbols & unit conversions 2025-05-31 20:34:59 +02:00