Skip to content

Commit

Permalink
fix: Fix requested output deleting extra outputs (#390) (#391)
Browse files Browse the repository at this point in the history
* fix: Hold GIL when deleting numpy array

* chore: setting py obj to None may not destruct the object
  • Loading branch information
kthui authored Dec 12, 2024
1 parent f3068c0 commit 3916e43
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pb_stub.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1032,9 +1032,9 @@ Stub::~Stub()

{
py::gil_scoped_acquire acquire;
async_event_loop_ = py::none();
background_futures_ = py::none();
model_instance_ = py::none();
py::object async_event_loop_local(std::move(async_event_loop_));
py::object background_futures_local(std::move(background_futures_));
py::object model_instance_local(std::move(model_instance_));
}
stub_instance_.reset();
stub_message_queue_.reset();
Expand Down
8 changes: 8 additions & 0 deletions src/pb_tensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,14 @@ PbTensor::~PbTensor() noexcept(false)
{
pb_memory_.reset();
DeleteDLPack();

#ifdef TRITON_PB_STUB
{
py::gil_scoped_acquire acquire;
py::array numpy_array_local(std::move(numpy_array_));
py::array numpy_array_serialized_local(std::move(numpy_array_serialized_));
}
#endif
}

const std::string&
Expand Down

0 comments on commit 3916e43

Please sign in to comment.