Skip to content

Commit 4f02dbc

Browse files
committed
fix: Fix race condition in model loading/unloading in Sagemaker server (#8571)
1 parent be99b05 commit 4f02dbc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/sagemaker_server.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,7 @@ SagemakerAPIServer::SageMakerMMEUnloadModel(
646646
target_model = model_name_hash;
647647
}
648648

649+
std::lock_guard<std::mutex> lock(models_list_mutex_);
649650
if (sagemaker_models_list_.find(model_name_hash) ==
650651
sagemaker_models_list_.end()) {
651652
LOG_VERBOSE(1) << "Model " << target_model << " with model hash "
@@ -740,7 +741,6 @@ SagemakerAPIServer::SageMakerMMEUnloadModel(
740741

741742
TRITONSERVER_ErrorDelete(unregister_err);
742743

743-
std::lock_guard<std::mutex> lock(models_list_mutex_);
744744
sagemaker_models_list_.erase(model_name_hash);
745745
}
746746

0 commit comments

Comments
 (0)