Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/pb_stub.cc
Original file line number Diff line number Diff line change
Expand Up @@ -936,10 +936,13 @@ Stub::RunCoroutine(py::object coroutine, bool in_background)
py::object py_future = py::module_::import("asyncio").attr(
"run_coroutine_threadsafe")(coroutine, loop);
if (in_background) {
// We should add the future to background_futures_ before attaching a
// done callback to avoid the issue described here:
// https://github.com/triton-inference-server/server/issues/8537
background_futures_.attr("add")(py_future);
py_future.attr("add_done_callback")(
py::module_::import("c_python_backend_utils")
.attr("async_event_future_done_callback"));
Comment on lines 943 to 945
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should never happen.

background_futures_.attr("add")(py_future);
return py::none();
}
return py_future.attr("result")();
Expand Down
Loading