summaryrefslogtreecommitdiff
path: root/searx/engines/__init__.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarIT.de>2026-06-10 15:48:49 +0200
committerGitHub <noreply@github.com>2026-06-10 15:48:49 +0200
commit26801e92af55cfef264fc34f0b84473e5bfc94cd (patch)
tree9b6c74c81751f2248594029d65b2afbe207f3c26 /searx/engines/__init__.py
parentf3fab143be3069bbcdcec9169bcf6ee030437a61 (diff)
[fix] sqlitedb: create DB Schema (DDL) during app initialization (hardening) (#6187)
The initialization of the DB schema ("base schema") has so far been done on demand, which causes race conditions with competing threads and processes. The DDL statements for creating the "base schema" are now executed as part of the initialization of the app. Further improvements were made to harden the database applications: - Wikidata & Radio-Browser engine perform their initialization only once (so far the initialization was carried out in each thread/process). - If multiple processes try to set DB's WAL mode when opening the DB at the same time, this usually leads to another race condition, which is now also caught. Related: - https://github.com/searxng/searxng/issues/6181#issuecomment-4586705 Closes: #6181 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/engines/__init__.py')
-rw-r--r--searx/engines/__init__.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/searx/engines/__init__.py b/searx/engines/__init__.py
index 1b1574b8b..e906b780b 100644
--- a/searx/engines/__init__.py
+++ b/searx/engines/__init__.py
@@ -12,6 +12,7 @@ import typing as t
import sys
import copy
+import os
from os.path import realpath, dirname
import types
@@ -278,6 +279,8 @@ def load_engines(engine_list: list[dict[str, t.Any]]):
else:
# if an engine can't be loaded (if for example the engine is missing
# tor or some other requirements) its set to inactive!
- logger.error("loading engine %s failed: set engine to inactive!", engine_data.get("name", "???"))
+ logger.error(
+ f"(PID {os.getpid()}) loading engine %s failed: set engine to inactive!", engine_data.get("name", "???")
+ )
engine_data["inactive"] = True
return engines