Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
0cc90a81
Unverified
Commit
0cc90a81
authored
Sep 02, 2025
by
Daniel Hiltgen
Committed by
GitHub
Sep 02, 2025
Browse files
harden uncaught exception registration (#12120)
parent
e42300f2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
2 deletions
+34
-2
llama/patches/0025-harden-uncaught-exception-registration.patch
...patches/0025-harden-uncaught-exception-registration.patch
+28
-0
ml/backend/ggml/ggml/src/ggml.cpp
ml/backend/ggml/ggml/src/ggml.cpp
+6
-2
No files found.
llama/patches/0025-harden-uncaught-exception-registration.patch
0 → 100644
View file @
0cc90a81
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Daniel Hiltgen <daniel@ollama.com>
Date: Fri, 29 Aug 2025 16:53:08 -0700
Subject: [PATCH] harden uncaught exception registration
---
ggml/src/ggml.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/ggml/src/ggml.cpp b/ggml/src/ggml.cpp
index 0d388d45..f5bcb446 100644
--- a/ggml/src/ggml.cpp
+++ b/ggml/src/ggml.cpp
@@ -19,8 +19,12 @@
static bool ggml_uncaught_exception_init = []{
return false;
}
const auto prev{std::get_terminate()};
- GGML_ASSERT(prev != ggml_uncaught_exception);
- previous_terminate_handler = prev;
+ // GGML_ASSERT(prev != ggml_uncaught_exception);
+ if (prev != ggml_uncaught_exception) {
+ previous_terminate_handler = prev;
+ } else {
+ GGML_LOG_WARN("%s double registration of ggml_uncaught_exception\n", __func__);
+ }
std::set_terminate(ggml_uncaught_exception);
return true;
}();
ml/backend/ggml/ggml/src/ggml.cpp
View file @
0cc90a81
...
@@ -19,8 +19,12 @@ static bool ggml_uncaught_exception_init = []{
...
@@ -19,8 +19,12 @@ static bool ggml_uncaught_exception_init = []{
return
false
;
return
false
;
}
}
const
auto
prev
{
std
::
get_terminate
()};
const
auto
prev
{
std
::
get_terminate
()};
GGML_ASSERT
(
prev
!=
ggml_uncaught_exception
);
// GGML_ASSERT(prev != ggml_uncaught_exception);
previous_terminate_handler
=
prev
;
if
(
prev
!=
ggml_uncaught_exception
)
{
previous_terminate_handler
=
prev
;
}
else
{
GGML_LOG_WARN
(
"%s double registration of ggml_uncaught_exception
\n
"
,
__func__
);
}
std
::
set_terminate
(
ggml_uncaught_exception
);
std
::
set_terminate
(
ggml_uncaught_exception
);
return
true
;
return
true
;
}();
}();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment