Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: shutdown should only shutdown current notebook (#1944)

Akshay Agrawald20d74f70898
diff --git a/marimo/_server/api/endpoints/execution.py b/marimo/_server/api/endpoints/execution.py
index 8d1adaba17..950b66c461 100644
--- a/marimo/_server/api/endpoints/execution.py
+++ b/marimo/_server/api/endpoints/execution.py
@@ -243,9 +243,10 @@ async def shutdown(
close_uvicorn(app_state.server)
# If we are only operating on a single file (new or explicit file),
- # then we should shutdown the whole server
+ # and there are no other sessions (user may have opened another notebook
+ # from the file explorer) then we should shutdown the whole server
key = file_router.get_unique_file_key()
- if key:
+ if key and len(session_manager.sessions) <= 1:
shutdown_server()
return SuccessResponse()