Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RNTupleView segfaults if used after reader destruction #16489

Open
1 task
jblomer opened this issue Sep 20, 2024 · 0 comments
Open
1 task

RNTupleView segfaults if used after reader destruction #16489

jblomer opened this issue Sep 20, 2024 · 0 comments
Assignees

Comments

@jblomer
Copy link
Contributor

jblomer commented Sep 20, 2024

Check duplicate issues.

  • Checked for duplicates

Description

When accessed after the generating RNTupleReader is gone, the RNTupleView segfaults. It should fail more gracefully.

Reproducer

TEST(RNTuple, ViewPastLifetime)
{
   FileRaii fileGuard("test_ntuple_view_pastlifetime.root");

   auto model = RNTupleModel::Create();
   auto fieldPt = model->MakeField<float>("pt", 42.0);
   {
      auto writer = RNTupleWriter::Recreate(std::move(model), "ntpl", fileGuard.GetPath());
      writer->Fill();
   }

   auto reader = RNTupleReader::Open("ntpl", fileGuard.GetPath());
   EXPECT_EQ(1u, reader->GetNEntries());
   auto viewPt = reader->GetView<float>("pt");
   reader.reset();
   EXPECT_FLOAT_EQ(42.0, viewPt(0));
}

ROOT version

master

Installation method

n/a

Operating system

n/a

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant