diff --git a/solara/server/kernel_context.py b/solara/server/kernel_context.py index 19a115bea..def62424b 100644 --- a/solara/server/kernel_context.py +++ b/solara/server/kernel_context.py @@ -383,7 +383,7 @@ def initialize_virtual_kernel(session_id: str, kernel_id: str, websocket: websoc if kernel_id in contexts: logger.info("reusing virtual kernel: %s", kernel_id) context = contexts[kernel_id] - if context.session_id != session_id: + if solara.server.settings.kernel.session_check and context.session_id != session_id: logger.critical("Session id mismatch when reusing kernel (hack attempt?): %s != %s", context.session_id, session_id) websocket.send_text("Session id mismatch when reusing kernel (hack attempt?)") # to avoid very fast reconnects (we are in a thread anyway) diff --git a/solara/server/settings.py b/solara/server/settings.py index f9e257c53..d08218246 100644 --- a/solara/server/settings.py +++ b/solara/server/settings.py @@ -108,6 +108,7 @@ class Kernel(BaseSettings): cull_timeout: str = "24h" max_count: Optional[int] = None threaded: bool = solara.util.has_threads + session_check: bool = True class Config: env_prefix = "solara_kernel_"