From 4bf2709de8de9f6ee894478387f65c2f72bae61e Mon Sep 17 00:00:00 2001 From: Sai Kiran Polisetty Date: Thu, 11 Jun 2026 16:18:41 +0530 Subject: [PATCH 1/5] Update --- src/pb_stub.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pb_stub.cc b/src/pb_stub.cc index 173a9c3e..b00d6d8b 100644 --- a/src/pb_stub.cc +++ b/src/pb_stub.cc @@ -1849,7 +1849,7 @@ PYBIND11_EMBEDDED_MODULE(c_python_backend_utils, module) auto stub = Stub::GetOrCreateInstance(); py::object loop = py::module_::import("asyncio").attr("get_running_loop")(); - py::cpp_function callback = [&stub, infer_request, decoupled]() { + py::cpp_function callback = [stub, infer_request, decoupled]() { std::shared_ptr response = infer_request->Exec(decoupled); py::object response_object; From 9ec5aedaf6a77691c39769bdb342b355766803de Mon Sep 17 00:00:00 2001 From: Sai Kiran Polisetty Date: Thu, 11 Jun 2026 16:23:30 +0530 Subject: [PATCH 2/5] Update --- src/pb_stub.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pb_stub.cc b/src/pb_stub.cc index b00d6d8b..eb13b73d 100644 --- a/src/pb_stub.cc +++ b/src/pb_stub.cc @@ -1849,6 +1849,7 @@ PYBIND11_EMBEDDED_MODULE(c_python_backend_utils, module) auto stub = Stub::GetOrCreateInstance(); py::object loop = py::module_::import("asyncio").attr("get_running_loop")(); + // Capture 'stub' by value (it is a shared_ptr). py::cpp_function callback = [stub, infer_request, decoupled]() { std::shared_ptr response = infer_request->Exec(decoupled); From 4b9b1ee11fa8866125e2500eb38ed34e939a837b Mon Sep 17 00:00:00 2001 From: Sai Kiran Polisetty Date: Fri, 12 Jun 2026 20:44:10 +0530 Subject: [PATCH 3/5] Update --- src/pb_stub.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/pb_stub.cc b/src/pb_stub.cc index eb13b73d..77183b4b 100644 --- a/src/pb_stub.cc +++ b/src/pb_stub.cc @@ -1496,8 +1496,16 @@ Stub::GetCUDAMemoryPoolAddress(std::unique_ptr& ipc_message) *(ipc_message->ResponseMutex())}; cuda_pool_message_ptr->waiting_on_stub = true; ipc_message->ResponseCondition()->notify_all(); - while (cuda_pool_message_ptr->waiting_on_stub) { - ipc_message->ResponseCondition()->wait(lock); + // This handler runs on the single ParentToStubMQMonitor thread, + // which is also the only thread that delivers decoupled BLS responses, + // so it must not block on the success path. + // It should only wait when an error message has been written to + // error_string_shm, so the parent can finish reading it before + // this function returns and frees that shared memory. + if (has_exception) { + while (cuda_pool_message_ptr->waiting_on_stub) { + ipc_message->ResponseCondition()->wait(lock); + } } } #endif @@ -1849,7 +1857,6 @@ PYBIND11_EMBEDDED_MODULE(c_python_backend_utils, module) auto stub = Stub::GetOrCreateInstance(); py::object loop = py::module_::import("asyncio").attr("get_running_loop")(); - // Capture 'stub' by value (it is a shared_ptr). py::cpp_function callback = [stub, infer_request, decoupled]() { std::shared_ptr response = infer_request->Exec(decoupled); From c90c7bced753e0a4e005692f76002412ed9fc393 Mon Sep 17 00:00:00 2001 From: Sai Kiran Polisetty Date: Fri, 12 Jun 2026 20:45:44 +0530 Subject: [PATCH 4/5] Update --- src/pb_stub.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pb_stub.cc b/src/pb_stub.cc index 77183b4b..6fc0fb29 100644 --- a/src/pb_stub.cc +++ b/src/pb_stub.cc @@ -1497,7 +1497,7 @@ Stub::GetCUDAMemoryPoolAddress(std::unique_ptr& ipc_message) cuda_pool_message_ptr->waiting_on_stub = true; ipc_message->ResponseCondition()->notify_all(); // This handler runs on the single ParentToStubMQMonitor thread, - // which is also the only thread that delivers decoupled BLS responses, + // which also delivers decoupled BLS responses, // so it must not block on the success path. // It should only wait when an error message has been written to // error_string_shm, so the parent can finish reading it before From a89b5c5144e3eeaf2a35f04ac9a6ab1b4e2f9aeb Mon Sep 17 00:00:00 2001 From: Sai Kiran Polisetty Date: Fri, 12 Jun 2026 22:25:27 +0530 Subject: [PATCH 5/5] Update --- src/pb_stub.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pb_stub.cc b/src/pb_stub.cc index 6fc0fb29..cd19f3ef 100644 --- a/src/pb_stub.cc +++ b/src/pb_stub.cc @@ -1500,7 +1500,7 @@ Stub::GetCUDAMemoryPoolAddress(std::unique_ptr& ipc_message) // which also delivers decoupled BLS responses, // so it must not block on the success path. // It should only wait when an error message has been written to - // error_string_shm, so the parent can finish reading it before + // error_string_shm, so the parent can finish reading it before // this function returns and frees that shared memory. if (has_exception) { while (cuda_pool_message_ptr->waiting_on_stub) {