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

meta: Disable TClass creation during tear down. #17814

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

pcanal
Copy link
Member

@pcanal pcanal commented Feb 24, 2025

Since code assume that the creation will succeed rather than returning nullptr, we create a trivial/empty TClass instead.

Copy link

github-actions bot commented Feb 24, 2025

Test Results

    18 files      18 suites   4d 12h 9m 30s ⏱️
 2 722 tests  2 721 ✅ 0 💤 1 ❌
47 307 runs  47 306 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit d2ef677.

♻️ This comment has been updated with latest results.

Copy link
Member

@hageboeck hageboeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Since code assume that the creation will succeed rather than returning nullptr, we create
a trivial/empty TClass instead.

This fixes root-project#17757
This fixes part of https://its.cern.ch/jira/browse/ROOT-10621

```
==1043887== Invalid write of size 8
==1043887==    at 0x48516D0: memmove (vg_replace_strmem.c:1414)
==1043887==    by 0x61D7416: TString::Replace(int, int, char const*, int) (TString.cxx:1073)
==1043887==    by 0x61D5997: TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (TString.cxx:334)
==1043887==    by 0x9CF27C1: TCling::MethodInfo_GetMangledName(MethodInfo_t*) const (TCling.cxx:9143)
==1043887==    by 0x62AEF87: TFunction::TFunction(MethodInfo_t*) (TFunction.cxx:45)
==1043887==    by 0x62BE03F: TMethod::TMethod(MethodInfo_t*, TClass*) (TMethod.cxx:41)
==1043887==    by 0x62BBA20: TListOfFunctions::Get(void const*) (TListOfFunctions.cxx:297)
==1043887==    by 0x628D5A4: TClass::GetClassMethodWithPrototype(char const*, char const*, bool, ROOT::EFunctionMatchMode) (TClass.cxx:4641)
==1043887==    by 0x6292A4B: TClass::Property() const (TClass.cxx:6243)
==1043887==    by 0x6291D99: TClass::IsForeign() const (TClass.cxx:6058)
==1043887==    by 0x59069C8: TBufferFile::WriteVersion(TClass const*, bool) (TBufferFile.cxx:3157)
==1043887==    by 0x61AB480: TObject::Streamer(TBuffer&) (TObject.cxx:933)
==1043887==    by 0x62390AE: TList::Streamer(TBuffer&) (TList.cxx:1248)
==1043887==    by 0x59C4B03: TKey::TKey(TObject const*, char const*, int, TDirectory*) (TKey.cxx:246)
==1043887==    by 0x5994C31: TFile::WriteStreamerInfo() (TFile.cxx:3897)
==1043887==    by 0x59878C6: TFile::Close(char const*) (TFile.cxx:976)
==1043887==    by 0x61CE672: void (anonymous namespace)::R__ListSlowClose<TDirectory>(TList*) (TROOT.cxx:1123)
==1043887==    by 0x61C7CE9: TROOT::CloseFiles() (TROOT.cxx:1173)
==1043887==    by 0x61C836B: TROOT::EndOfProcessCleanups() (TROOT.cxx:1252)
==1043887==    by 0x615DAB5: CallEndOfProcessCleanups() (TApplication.cxx:90)
==1043887==    by 0x6906E2C: __run_exit_handlers (in /usr/lib64/libc.so.6)
==1043887==    by 0x6906F6F: exit (in /usr/lib64/libc.so.6)
==1043887==    by 0x68EF5D6: (below main) (in /usr/lib64/libc.so.6)
==1043887==  Address 0x8d5dab0 is 0 bytes inside a block of size 64 free'd
==1043887==    at 0x484A547: operator delete[](void*) (vg_replace_malloc.c:1410)
==1043887==    by 0x5908D80: TString::UnLink() const (TString.h:263)
==1043887==    by 0x61D566B: TString::~TString() (TString.cxx:253)
==1043887==    by 0x690755E: __call_tls_dtors (in /usr/lib64/libc.so.6)
==1043887==    by 0x6906F25: __run_exit_handlers (in /usr/lib64/libc.so.6)
==1043887==    by 0x6906F6F: exit (in /usr/lib64/libc.so.6)
==1043887==    by 0x68EF5D6: (below main) (in /usr/lib64/libc.so.6)
==1043887==  Block was alloc'd at
==1043887==    at 0x4846627: operator new[](unsigned long) (vg_replace_malloc.c:729)
==1043887==    by 0x61D7462: TString::Replace(int, int, char const*, int) (TString.cxx:1078)
==1043887==    by 0x61D5997: TString::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (TString.cxx:334)
==1043887==    by 0x9CF27C1: TCling::MethodInfo_GetMangledName(MethodInfo_t*) const (TCling.cxx:9143)
==1043887==    by 0x62AEF87: TFunction::TFunction(MethodInfo_t*) (TFunction.cxx:45)
==1043887==    by 0x62BE03F: TMethod::TMethod(MethodInfo_t*, TClass*) (TMethod.cxx:41)
==1043887==    by 0x62BBA20: TListOfFunctions::Get(void const*)(TListOfFunctions.cxx:297)
```
This avoids the need to fill out a TClass at tear down.

This addresses part of https://its.cern.ch/jira/browse/ROOT-10621.

```
==1038957== Invalid write of size 1
==1038957==    at 0xC01AC9E: std::char_traits<char>::assign(char&, char const&) (char_traits.h:357)
==1038957==    by 0xC01D470: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_set_length(unsigned long) (basic_string.h:225)
==1038957==    by 0xC041DD6: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::clear() (basic_string.h:1016)
==1038957==    by 0xC3BCDC1: TClingClassInfo::FullName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, ROOT::TMetaUtils::TNormalizedCtxt const&) const (TCling
ClassInfo.cxx:1379)
==1038957==    by 0xC3969CB: TClingBaseClassInfo::FullName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, ROOT::TMetaUtils::TNormalizedCtxt const&) const (TClingBaseClassInfo.cxx:567)
==1038957==    by 0xC20D46F: TCling::BaseClassInfo_FullName(BaseClassInfo_t*) const (TCling.cxx:8577)
==1038957==    by 0x4D05086: TBaseClass::TBaseClass(BaseClassInfo_t*, TClass*) (TBaseClass.cxx:40)
==1038957==    by 0xC1FD03C: TCling::CreateListOfBaseClasses(TClass*) const (TCling.cxx:4406)
==1038957==    by 0x4D14308: TClass::GetListOfBases() (TClass.cxx:3760)
==1038957==    by 0x4D10FE1: TClass::GetBaseClass(TClass const*) (TClass.cxx:2782)
==1038957==    by 0x4D1853F: TClass::InheritsFrom(TClass const*) const (TClass.cxx:5002)
==1038957==    by 0x4C34137: TObject::InheritsFrom(TClass const*) const (TObject.cxx:552)
==1038957==    by 0x5391BA4: TDirectoryFile::Save() (TDirectoryFile.cxx:1564)
==1038957==    by 0x538DB5A: TDirectoryFile::Close(char const*) (TDirectoryFile.cxx:568)
==1038957==    by 0x53A9A17: TFile::Close(char const*) (TFile.cxx:994)
==1038957==    by 0x4C58672: void (anonymous namespace)::R__ListSlowClose<TDirectory>(TList*) (TROOT.cxx:1123)
==1038957==    by 0x4C51CE9: TROOT::CloseFiles() (TROOT.cxx:1173)
==1038957==    by 0x4C5236B: TROOT::EndOfProcessCleanups() (TROOT.cxx:1252)
==1038957==    by 0x4BE7AB5: CallEndOfProcessCleanups() (TApplication.cxx:90)
==1038957==    by 0x7B14E2C: __run_exit_handlers (in /usr/lib64/libc.so.6)
==1038957==    by 0x7B14F6F: exit (in /usr/lib64/libc.so.6)
==1038957==    by 0x7AFD5D6: (below main) (in /usr/lib64/libc.so.6)
==1038957==  Address 0xb1ee930 is 0 bytes inside a block of size 121 free'd
==1038957==    at 0x4848A4D: operator delete(void*, unsigned long) (vg_replace_malloc.c:1181)
==1038957==    by 0xC01EB76: __gnu_cxx::new_allocator<char>::deallocate(char*, unsigned long) (new_allocator.h:145)
==1038957==    by 0xC01E273: std::allocator_traits<std::allocator<char> >::deallocate(std::allocator<char>&, char*, unsigned long) (alloc_traits.h:496)
==1038957==    by 0xC01D91B: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_destroy(unsigned long) (basic_string.h:245)
==1038957==    by 0xC01D341: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose() (basic_string.h:240)
==1038957==    by 0xC01C803: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() (basic_string.h:672)
==1038957==    by 0x7B1555E: __call_tls_dtors (in /usr/lib64/libc.so.6)
==1038957==    by 0x7B14F25: __run_exit_handlers (in /usr/lib64/libc.so.6)
==1038957==    by 0x7B14F6F: exit (in /usr/lib64/libc.so.6)
==1038957==    by 0x7AFD5D6: (below main) (in /usr/lib64/libc.so.6)
==1038957==  Block was alloc'd at
==1038957==    at 0x4844EE1: operator new(unsigned long) (vg_replace_malloc.c:487)
==1038957==    by 0x791124D: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate(unsigned long, unsigned long, char const*, unsigned long) (basic_string.
tcc:307)
==1038957==    by 0x7912B82: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long) (basic_string.tcc:395)
==1038957==    by 0x4CEEF7F: TClassEdit::TSplitType::ShortType(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int) (TClassEdit.cxx:500)
==1038957==    by 0xC03076F: ROOT::TMetaUtils::GetNormalizedName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, clang::QualType const&, cling::Interpreter co
nst&, ROOT::TMetaUtils::TNormalizedCtxt const&) (TClingUtils.cxx:4180)
==1038957==    by 0xC3BCE2F: TClingClassInfo::FullName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, ROOT::TMetaUtils::TNormalizedCtxt const&) const (TCling
ClassInfo.cxx:1385)
==1038957==    by 0xC3969CB: TClingBaseClassInfo::FullName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, ROOT::TMetaUtils::TNormalizedCtxt const&) const (TC
lingBaseClassInfo.cxx:567)
==1038957==    by 0xC20D46F: TCling::BaseClassInfo_FullName(BaseClassInfo_t*) const (TCling.cxx:8577)
==1038957==    by 0x4D05086: TBaseClass::TBaseClass(BaseClassInfo_t*, TClass*) (TBaseClass.cxx:40)

```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

TClass object can be generated during tear down which can lead to the user of already deleted resources.
2 participants