From c800493ad8928ff75ae0e02750732bde522c51c4 Mon Sep 17 00:00:00 2001 From: David Gardner Date: Mon, 14 Oct 2024 16:58:49 -0700 Subject: [PATCH] Test to reproduce issue #1934 --- .../_lib/tests/messages/test_message_meta.cpp | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/python/morpheus/morpheus/_lib/tests/messages/test_message_meta.cpp b/python/morpheus/morpheus/_lib/tests/messages/test_message_meta.cpp index 7214571f32..4289e73ae2 100644 --- a/python/morpheus/morpheus/_lib/tests/messages/test_message_meta.cpp +++ b/python/morpheus/morpheus/_lib/tests/messages/test_message_meta.cpp @@ -26,8 +26,10 @@ #include "morpheus/objects/tensor.hpp" // for Tensor #include "morpheus/types.hpp" // for RangeType -#include // for TestInfo, TEST_F -#include // for gil_scoped_release +#include // for TestInfo, TEST_F +#include // for gil_scoped_release +#include +#include #include // for cuda_stream_per_thread #include // for device_buffer @@ -38,6 +40,7 @@ using namespace morpheus; using namespace morpheus::test; +using namespace pybind11::literals; using TestMessageMeta = morpheus::test::TestMessages; // NOLINT(readability-identifier-naming) @@ -82,3 +85,25 @@ TEST_F(TestMessageMeta, CopyRangeAndSlicing) assert_eq_device_to_host(sliced_meta->get_info().get_column(0), sliced_expected_int); assert_eq_device_to_host(sliced_meta->get_info().get_column(1), sliced_expected_double); } + +TEST_F(TestMessageMeta, Issue1934) +{ + // Reproduce issue 1934 (https://github.com/nv-morpheus/Morpheus/issues/1934) + // The bug causes a segfault when calling `get_data_frame` on a message meta object + namespace py = pybind11; + py::gil_scoped_acquire gil; + + auto cudf_mod = py::module_::import("cudf"); + auto a_col = py::list(); + auto v1 = py::list(); + v1.append(py::str("a")); + a_col.attr("append")(std::move(v1)); + a_col.attr("append")(py::none()); + + auto df = cudf_mod.attr("DataFrame")(py::dict("a"_a = std::move(a_col))); + df.attr("drop")(0, "inplace"_a = true); + + auto msg = MessageMetaInterfaceProxy::init_python(std::move(df)); + + auto df_copy = MessageMetaInterfaceProxy::get_data_frame(*msg); +}