You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the app restarts via app.restart() (e.g., after changing database location in Settings), the process crashes with a SIGABRT due to an assertion failure in the ggml Metal backend:
The crash occurs because app.restart() calls std::process::exit(), which triggers C++ destructors via __cxa_finalize_ranges. The Metal residency set for the embedding model still has active data when ggml_metal_rsets_free runs, causing the assertion to fail.
The NLP embedding engine (EmbeddingService wrapping llama.cpp) is never explicitly shut down before exit(). The Metal GPU resources (residency sets, buffers) are still active when the process destructor chain runs, triggering the assertion.
This is the same underlying issue as #885 (crash on quit), but manifests specifically through the restart_app command path introduced in #892.
Reproduction
Launch app: bun run dev:tauri
Open Settings (Cmd+,)
Click "Change Location" under Database
Select a folder
Confirm restart → crash with assertion failure
The app does restart successfully (the new process launches), but the old process crashes instead of exiting cleanly.
Before calling app.restart(), explicitly drop/shutdown the embedding resources:
Immediate fix: In restart_app, signal the EmbeddingProcessor to stop, drop the EmbeddingService/NLP engine (releases Metal resources), then call app.restart()
Problem
When the app restarts via
app.restart()(e.g., after changing database location in Settings), the process crashes with aSIGABRTdue to an assertion failure in the ggml Metal backend:The crash occurs because
app.restart()callsstd::process::exit(), which triggers C++ destructors via__cxa_finalize_ranges. The Metal residency set for the embedding model still has active data whenggml_metal_rsets_freeruns, causing the assertion to fail.Stack Trace (Key Frames)
Root Cause
The NLP embedding engine (
EmbeddingServicewrapping llama.cpp) is never explicitly shut down beforeexit(). The Metal GPU resources (residency sets, buffers) are still active when the process destructor chain runs, triggering the assertion.This is the same underlying issue as #885 (crash on quit), but manifests specifically through the
restart_appcommand path introduced in #892.Reproduction
bun run dev:tauriThe app does restart successfully (the new process launches), but the old process crashes instead of exiting cleanly.
Related
restart_appcommand that triggers this pathProposed Fix
Before calling
app.restart(), explicitly drop/shutdown the embedding resources:restart_app, signal theEmbeddingProcessorto stop, drop theEmbeddingService/NLP engine (releases Metal resources), then callapp.restart()Environment
Acceptance Criteria
restart_appcommand gracefully shuts down embedding engine before restartingSIGABRT/ assertion failure on restart