Skip to content

Commit 9e6705c

Browse files
committed
1 parent 47f9e03 commit 9e6705c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/pb_stub.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,10 +936,13 @@ Stub::RunCoroutine(py::object coroutine, bool in_background)
936936
py::object py_future = py::module_::import("asyncio").attr(
937937
"run_coroutine_threadsafe")(coroutine, loop);
938938
if (in_background) {
939+
// We should add the future to background_futures_ before attaching a
940+
// done callback to avoid the issue described here:
941+
// https://github.com/triton-inference-server/server/issues/8537
942+
background_futures_.attr("add")(py_future);
939943
py_future.attr("add_done_callback")(
940944
py::module_::import("c_python_backend_utils")
941945
.attr("async_event_future_done_callback"));
942-
background_futures_.attr("add")(py_future);
943946
return py::none();
944947
}
945948
return py_future.attr("result")();

0 commit comments

Comments
 (0)