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

Double call to TNetXNGFile::Close() leads to a segfault #13503

Closed
1 task done
veprbl opened this issue Aug 21, 2023 · 4 comments · Fixed by #13559
Closed
1 task done

Double call to TNetXNGFile::Close() leads to a segfault #13503

veprbl opened this issue Aug 21, 2023 · 4 comments · Fixed by #13559
Assignees
Labels

Comments

@veprbl
Copy link
Contributor

veprbl commented Aug 21, 2023

Check duplicate issues.

  • Checked for duplicates

Description

Double call to TNetXNGFile::Close() leads to a segfault, which is not the case for TFile::Close() in general. This leads to bugs when integrating software together like AIDASoft/DD4hep#1156.

Reproducer

TFile *_file0 = TFile::Open("root://dtn-eic.jlab.org//work/eic2/EPIC/Tutorials/pythia8NCDIS_10x100_minQ2=1_beamEffects_xAngle=-0.025_hiDiv.hepmc3.tree.root");
_file0->Close();
_file0->Close();

ROOT version

ROOT 6.26/06
xrootd-5.4.3

Installation method

from nixpkgs

Operating system

macOS

Additional context

No response

@veprbl veprbl added the bug label Aug 21, 2023
@Axel-Naumann
Copy link
Member

Thanks, @veprbl

Copying the stacktrace from the original, linked report:

#6  <signal handler called>
#7  0x00007fe343359b6a in XrdCl::File::Close(XrdCl::ResponseHandler*, unsigned short) () from /opt/software/linux-ubuntu23.04-skylake/gcc-12.3.0/xrootd-5.6.1-4hhj2qxu72su5ur6i2x5as7tabayobgz/lib/libXrdCl.so.3
#8  0x00007fe343359c85 in XrdCl::File::Close(unsigned short) () from /opt/software/linux-ubuntu23.04-skylake/gcc-12.3.0/xrootd-5.6.1-4hhj2qxu72su5ur6i2x5as7tabayobgz/lib/libXrdCl.so.3
#9  0x00007fe3462e24d3 in TNetXNGFile::Close(char const*) () from /opt/software/linux-ubuntu23.04-skylake/gcc-12.3.0/root-6.28.04-zjvl6wz23xtpv2dj4b73bj3yxsws43i4/lib/root/libNetxNG.so.6.28.04
#10 0x00007fe346ac1377 in HepMC3::ReaderRootTree::close (this=0x55cb53cbff00) at /data/spack/stage/wdconinc/spack-stage-hepmc3-3.2.6-m4mzua36zxrtruwv25lqk5yf7iucr3pc/spack-src/rootIO/src/ReaderRootTree.cc:114
#11 0x00007fe34385b7ee in HepMC3::ReaderPlugin::~ReaderPlugin (this=0x55cb53cb5e50, __in_chrg=<optimized out>) at /data/spack/stage/wdconinc/spack-stage-hepmc3-3.2.6-m4mzua36zxrtruwv25lqk5yf7iucr3pc/spack-src/src/ReaderPlugin.cc:68
#12 0x00007fe345e35994 in std::_Destroy<HepMC3::ReaderPlugin> (__pointer=0x55cb53cb5e50) at /usr/include/c++/12/bits/stl_construct.h:151
#13 0x00007fe345e358ec in std::allocator_traits<std::allocator<void> >::destroy<HepMC3::ReaderPlugin> (__p=0x55cb53cb5e50) at /usr/include/c++/12/bits/alloc_traits.h:648
#14 0x00007fe345e350df in std::_Sp_counted_ptr_inplace<HepMC3::ReaderPlugin, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_M_dispose (this=0x55cb53cb5e40) at /usr/include/c++/12/bits/shared_ptr_base.h:613
#15 0x00007fe36b71e887 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() () from /opt/software/linux-ubuntu23.04-skylake/gcc-12.3.0/root-6.28.04-zjvl6wz23xtpv2dj4b73bj3yxsws43i4/lib/root/libRIO.so
#16 0x00007fe356ee7fcd in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (this=0x7fff8c03a978, __in_chrg=<optimized out>) at /usr/include/c++/12/bits/shared_ptr_base.h:1071
#17 0x00007fe345e21200 in std::__shared_ptr<HepMC3::Reader, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x7fff8c03a970, __in_chrg=<optimized out>) at /usr/include/c++/12/bits/shared_ptr_base.h:1524
#18 0x00007fe345e266d4 in std::__shared_ptr<HepMC3::Reader, (__gnu_cxx::_Lock_policy)2>::operator= (this=0x55cb53cb4a48, __r=...) at /usr/include/c++/12/bits/shared_ptr_base.h:1620
#19 0x00007fe345e233f0 in std::shared_ptr<HepMC3::Reader>::operator= (this=0x55cb53cb4a48, __r=...) at /usr/include/c++/12/bits/shared_ptr.h:440
#20 0x00007fe345e1ce84 in dd4hep::sim::HEPMC3FileReader::HEPMC3FileReader (this=0x55cb53cb49d0, nam=...) at /home/wdconinc/git/DD4hep/DDG4/hepmc/HepMC3FileReader.cpp:140
#21 0x00007fe345e1d6ff in (anonymous namespace)::Factory<dd4hep::sim::HEPMC3FileReader, dd4hep::sim::Geant4EventReader*(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)>::call(std::string) (a0=...) at /home/wdconinc/git/DD4hep/DDG4/include/DDG4/Factories.h:176
#22 0x00007fe34cccafcc in dd4hep::PluginService::Create<dd4hep::sim::Geant4EventReader*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > (id=...) at /home/wdconinc/git/DD4hep/DDCore/include/DD4hep/Plugins.h:102

@Axel-Naumann
Copy link
Member

@amadio would you expect XrdClient to survive repeated calls to Close()?

@Axel-Naumann Axel-Naumann self-assigned this Aug 22, 2023
@amadio
Copy link
Member

amadio commented Aug 22, 2023

@Axel-Naumann I will see what can be done on our side about this and fix in the next release if I find a good solution.

@linev
Copy link
Member

linev commented Aug 29, 2023

There is very simple fix to make TNetXNGFile::Close() reentrant.
See PR: #13559

@linev linev added this to Issues in Fixed in 6.30/00 via automation Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

4 participants