Skip to content

Commit a12b1f6

Browse files
committed
Update
1 parent 5171c68 commit a12b1f6

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/python_be.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)