mirror of
https://github.com/searxng/searxng.git
synced 2025-07-12 07:49:22 +02:00
[fix] granian: enabling debug on searxng-docker causes server crash (#4985)
Some checks are pending
Documentation / Release (push) Waiting to run
Integration / Python 3.10 (push) Waiting to run
Integration / Python 3.11 (push) Waiting to run
Integration / Python 3.12 (push) Waiting to run
Integration / Python 3.13 (push) Waiting to run
Integration / Python 3.9 (push) Waiting to run
Integration / Theme (push) Waiting to run
Some checks are pending
Documentation / Release (push) Waiting to run
Integration / Python 3.10 (push) Waiting to run
Integration / Python 3.11 (push) Waiting to run
Integration / Python 3.12 (push) Waiting to run
Integration / Python 3.13 (push) Waiting to run
Integration / Python 3.9 (push) Waiting to run
Integration / Theme (push) Waiting to run
When debugging is enabled, the context in which the process is running (uWSGI or `Flask.run` server) was previously checked [1]. This check has not yet taken the granian server into account. ---- The check is actually only required for the developer environment (`make run`) [2] and is intended to prevent double loading of modules when initializing a Flask server [3]. In the long term, we should find a more robust solution that explicitly enables the specific features of a development environment via switches. Further information on this problematic code can be found in [4][5][6]. [1] https://github.com/searxng/searxng/issues/4973#issuecomment-3047890957 [2] https://flask.palletsprojects.com/en/stable/api/#flask.Flask.run [3] https://github.com/pallets/flask/issues/5307#issuecomment-1774646119 [4] https://github.com/searxng/searxng/pull/1656#issuecomment-1214198941 [5] https://github.com/searxng/searxng/pull/1616#issuecomment-1206137468 [6] https://stackoverflow.com/a/25504196 - closes: https://github.com/searxng/searxng/issues/4973 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
fe52290e65
commit
bd593d0bad
1 changed files with 3 additions and 3 deletions
|
@ -1350,9 +1350,9 @@ def is_werkzeug_reload_active() -> bool:
|
||||||
.. _werkzeug.serving:
|
.. _werkzeug.serving:
|
||||||
https://werkzeug.palletsprojects.com/en/stable/serving/#werkzeug.serving.run_simple
|
https://werkzeug.palletsprojects.com/en/stable/serving/#werkzeug.serving.run_simple
|
||||||
"""
|
"""
|
||||||
|
logger.debug("sys.argv: %s", sys.argv)
|
||||||
if "uwsgi" in sys.argv:
|
if "uwsgi" in sys.argv[0] or "granian" in sys.argv[0]:
|
||||||
# server was launched by uWSGI
|
# server was launched by granian (or uWSGI)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# https://github.com/searxng/searxng/pull/1656#issuecomment-1214198941
|
# https://github.com/searxng/searxng/pull/1656#issuecomment-1214198941
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue