Skip to content

Commit 02304be

Browse files
committed
cuda: keep leaked AOTI libraries loaded
Generated with Codex.
1 parent 6cf890d commit 02304be

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

‎backends/cuda/runtime/cuda_backend.cpp‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -879,20 +879,14 @@ class ET_EXPERIMENTAL CudaBackend final
879879
// NOTE: AOTInductorModelContainerDelete does not work correctly with
880880
// multiple .so files. Deleting one container frees shared resources,
881881
// which causes segmentation faults when attempting to delete other
882-
// containers. As a workaround, we skip explicit container deletion
883-
// and defer cleanup to the OS.
882+
// containers. As a workaround, we skip explicit container deletion and
883+
// defer cleanup to the OS. The corresponding shared library must remain
884+
// loaded as well: the leaked container still owns objects whose code and
885+
// process-wide state live in that library, so dlclose/FreeLibrary can
886+
// invalidate them and crash during multi-method teardown.
884887
// TODO(gasoonjia): Find a proper solution for safe container deletion.
885888
// AOTInductorModelContainerDelete(handle->container_handle);
886889

887-
// Now close the shared library
888-
if (handle->so_handle != nullptr) {
889-
Error err = close_library(handle->so_handle);
890-
ET_CHECK_OR_LOG_ERROR(
891-
err == Error::Ok,
892-
"Failed to close shared library for %s",
893-
handle->so_path.c_str());
894-
}
895-
896890
// Remove the temporary shared library file
897891
if (!handle->so_path.empty()) {
898892
std::error_code remove_error;

0 commit comments

Comments
 (0)