Skip to content

Commit b771f4f

Browse files
authored
fix: Fix requested output deleting extra outputs (#390)
* fix: Hold GIL when deleting numpy array * chore: setting py obj to None may not destruct the object
1 parent 8e12347 commit b771f4f

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/pb_stub.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,9 +1032,9 @@ Stub::~Stub()
10321032

10331033
{
10341034
py::gil_scoped_acquire acquire;
1035-
async_event_loop_ = py::none();
1036-
background_futures_ = py::none();
1037-
model_instance_ = py::none();
1035+
py::object async_event_loop_local(std::move(async_event_loop_));
1036+
py::object background_futures_local(std::move(background_futures_));
1037+
py::object model_instance_local(std::move(model_instance_));
10381038
}
10391039
stub_instance_.reset();
10401040
stub_message_queue_.reset();

src/pb_tensor.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,14 @@ PbTensor::~PbTensor() noexcept(false)
503503
{
504504
pb_memory_.reset();
505505
DeleteDLPack();
506+
507+
#ifdef TRITON_PB_STUB
508+
{
509+
py::gil_scoped_acquire acquire;
510+
py::array numpy_array_local(std::move(numpy_array_));
511+
py::array numpy_array_serialized_local(std::move(numpy_array_serialized_));
512+
}
513+
#endif
506514
}
507515

508516
const std::string&

0 commit comments

Comments
 (0)