File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -921,8 +921,15 @@ ModelInstanceState::UserModelReadinessCleanupTask(
921921 {
922922 bi::scoped_lock<bi::interprocess_mutex> cleanup_lock{
923923 *(ipc_message_cleanup->ResponseMutex ())};
924+ // Use bounded waits so cleanup can periodically re-check stub liveness
925+ // and avoid blocking forever if no notification arrives.
926+ constexpr int64_t kCleanupLivenessPollMs = 100 ;
924927 while (!payload->waiting_on_stub ) {
925- ipc_message_cleanup->ResponseCondition ()->wait (cleanup_lock);
928+ boost::posix_time::ptime timeout =
929+ boost::get_system_time () +
930+ boost::posix_time::milliseconds (kCleanupLivenessPollMs );
931+ ipc_message_cleanup->ResponseCondition ()->timed_wait (
932+ cleanup_lock, timeout);
926933 if (!payload->waiting_on_stub && !IsStubProcessAlive ()) {
927934 abort_wait = true ;
928935 break ;
You can’t perform that action at this time.
0 commit comments