fix(onnx): Use patched version of onnxruntime
This commit is contained in:
42
patches/ort_env_global_mutex.patch
Normal file
42
patches/ort_env_global_mutex.patch
Normal file
@@ -0,0 +1,42 @@
|
||||
From 83e1dbf52b7695a2966795e0350aaa385d1ba8c8 Mon Sep 17 00:00:00 2001
|
||||
From: "Carson M." <carson@pyke.io>
|
||||
Date: Sun, 22 Jun 2025 23:53:20 -0500
|
||||
Subject: [PATCH] Leak logger mutex
|
||||
|
||||
---
|
||||
onnxruntime/core/common/logging/logging.cc | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/onnxruntime/core/common/logging/logging.cc b/onnxruntime/core/common/logging/logging.cc
|
||||
index a79e7300cffce..07578fc72ca99 100644
|
||||
--- a/onnxruntime/core/common/logging/logging.cc
|
||||
+++ b/onnxruntime/core/common/logging/logging.cc
|
||||
@@ -64,8 +64,8 @@ LoggingManager* LoggingManager::GetDefaultInstance() {
|
||||
#pragma warning(disable : 26426)
|
||||
#endif
|
||||
|
||||
-static std::mutex& DefaultLoggerMutex() noexcept {
|
||||
- static std::mutex mutex;
|
||||
+static std::mutex* DefaultLoggerMutex() noexcept {
|
||||
+ static std::mutex* mutex = new std::mutex();
|
||||
return mutex;
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ LoggingManager::LoggingManager(std::unique_ptr<ISink> sink, Severity default_min
|
||||
|
||||
// lock mutex to create instance, and enable logging
|
||||
// this matches the mutex usage in Shutdown
|
||||
- std::lock_guard<std::mutex> guard(DefaultLoggerMutex());
|
||||
+ std::lock_guard<std::mutex> guard(*DefaultLoggerMutex());
|
||||
|
||||
if (DefaultLoggerManagerInstance().load() != nullptr) {
|
||||
ORT_THROW("Only one instance of LoggingManager created with InstanceType::Default can exist at any point in time.");
|
||||
@@ -127,7 +127,7 @@ LoggingManager::LoggingManager(std::unique_ptr<ISink> sink, Severity default_min
|
||||
LoggingManager::~LoggingManager() {
|
||||
if (owns_default_logger_) {
|
||||
// lock mutex to reset DefaultLoggerManagerInstance() and free default logger from this instance.
|
||||
- std::lock_guard<std::mutex> guard(DefaultLoggerMutex());
|
||||
+ std::lock_guard<std::mutex> guard(*DefaultLoggerMutex());
|
||||
#if ((__cplusplus >= 201703L) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L)))
|
||||
DefaultLoggerManagerInstance().store(nullptr, std::memory_order_release);
|
||||
#else
|
||||
Reference in New Issue
Block a user