-
Notifications
You must be signed in to change notification settings - Fork 14.6k
fix: Provide macos-specific backtrace printing to avoid terminal death #17869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Branch: MacOSSafeBacktrace Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
|
@ggerganov Is there a good macos specialist to look at this one? |
|
The
|
|
@ggerganov I think that makes sense. Have you (or any other MacOS users) observed this behavior? It looks like this has something to do with the interaction of |
|
@gabe-l-hart |
Branch: MacOSSafeBacktrace Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
4a1e27e to
87297bd
Compare
|
Makes sense! For some unexplainable reason, I've always resisted non-standard terminals (we programmers are a strange bunch), but I'm glad it's only a problem with |
…ath (ggml-org#17869) * fix: Provide macos-specific backtrace printing to avoid terminal death Branch: MacOSSafeBacktrace Signed-off-by: Gabe Goodhart <ghart@us.ibm.com> * fix: Add GGML_BACKTRACE_LLDB env var to enable using lldb for backtrace Branch: MacOSSafeBacktrace Signed-off-by: Gabe Goodhart <ghart@us.ibm.com> --------- Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
…ath (ggml-org#17869) * fix: Provide macos-specific backtrace printing to avoid terminal death Branch: MacOSSafeBacktrace Signed-off-by: Gabe Goodhart <ghart@us.ibm.com> * fix: Add GGML_BACKTRACE_LLDB env var to enable using lldb for backtrace Branch: MacOSSafeBacktrace Signed-off-by: Gabe Goodhart <ghart@us.ibm.com> --------- Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
- Add disposed flag to prevent double-dispose - Don't explicitly dispose llama resources in dispose() - just clear refs - Let process exit handle Metal cleanup naturally - Remove disposeDefaultLlamaCpp call from eval tests Note: llama.cpp Metal backend still crashes at process exit due to ggml-metal cleanup issues. This is a known upstream issue: ggml-org/llama.cpp#17869 All tests pass (12/12), the abort happens after test completion. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The Metal backend crash happens regardless of whether we dispose or not. It's a known llama.cpp issue during process exit static destructor cleanup: ggml-org/llama.cpp#17869 All 297 tests pass - the abort happens after tests complete. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
… calls - dispose() now just calls llama.dispose() which cascades to models/contexts per node-llama-cpp lifecycle docs - Remove disposeDefaultLlamaCpp calls from tests - they don't help with the Metal cleanup crash - Use singleton getDefaultLlamaCpp() in llm tests for consistency The Metal backend crash at process exit is a known llama.cpp issue: ggml-org/llama.cpp#17869 All tests pass - the abort happens after test completion. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ath (ggml-org#17869) * fix: Provide macos-specific backtrace printing to avoid terminal death Branch: MacOSSafeBacktrace Signed-off-by: Gabe Goodhart <ghart@us.ibm.com> * fix: Add GGML_BACKTRACE_LLDB env var to enable using lldb for backtrace Branch: MacOSSafeBacktrace Signed-off-by: Gabe Goodhart <ghart@us.ibm.com> --------- Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
Description
In my development environment on MacOS, any time I hit a failing
GGML_ASSERT, my entireTerminal.appcrashes (all windows, all processes, not just the ones involving the failing binary). I traced this down to the attempt to uselldbto print out a backtrace here.The simplest fix is simply setting
GGML_NO_BACKTRACEin the environment, but this is unset by default and needs to be discovered. It also needs to either be set in a global.bash_profileor set on every terminal.This PR adds an
__APPLE__-specific code path that uses the nativebacktrace()function and avoids attempting to attach to the parent from the forkedlldbprocess.Testing
To repro this, add a failing
GGML_ASSERTsomewhere, for example:Once built, run it and hit the assert:
Sources
(Found with the help of Claude Code)