-
Notifications
You must be signed in to change notification settings - Fork 14
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
Addresssanitizer: alloc-dealloc-mismatch (malloc vs operator delete []) after opening a saved simulation #16
Comments
It looks like it loads file in one of the previous formats. Will the
behaviour be the same if you resave this file with the current version?
…On Tue, 30 Mar 2021, 23:27 Anton Gladky, ***@***.***> wrote:
Dyssol, compiled with AddressSanitizer crashes after opening any saved
simulation with the following backtrace:
`=================================================================
==2847510==ERROR: AddressSanitizer: alloc-dealloc-mismatch (malloc vs
operator delete []) on 0x602000808650
#0 0x6344cd in operator delete <http://void*>
(/inst-clang-asan/bin/DyssolGUI+0x6344cd)
#1 <#1>
0x7fc8e6c06f4a in CH5Handler::ReadData(std::__cxx11::basic_string<char,
std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char,
std::char_traits, std::allocator > const&,
std::vector<std::__cxx11::basic_string<char, std::char_traits,
std::allocator >, std::allocator<std::__cxx11::basic_string<char,
std::char_traits, std::allocator > > >&) const
/Dyssol-open/HDF5Handler/H5Handler.cpp:264:3
#2 <#2>
0x7fc8e6d2cbfc in CDistributionsGrid::LoadFromFile(CH5Handler&,
std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)
/Dyssol-open/ModelsAPI/DistributionsGrid.cpp:320:11
#3 <#3>
0x7fc8e6e33a30 in CFlowsheet::LoadFromFile_v3(CH5Handler&,
std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)
/Dyssol-open/SimulatorCore/Flowsheet.cpp:765:9
#4 <#4>
0x7fc8e6e321fc in CFlowsheet::LoadFromFile(CH5Handler&,
std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t> > const&)
/Dyssol-open/SimulatorCore/Flowsheet.cpp:696:10
#5 <#5> 0x68ebec
in CSaveLoadThread::StartTask()
/Dyssol-open/DyssolMainWindow/SaveLoadThread.cpp:46:31
#6 <#6> 0x7dd940
in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>,
void, void (CBasicThread::*)()>::call(void (CBasicThread::*)(),
CBasicThread*, void**)
/usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:152:13
#7 <#7> 0x7dd878
in void QtPrivate::FunctionPointer<void (CBasicThread::*)()>::call<QtPrivate::List<>,
void>(void (CBasicThread::*)(), CBasicThread*, void**)
/usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:185:13
#8 <#8> 0x7dd797
in QtPrivate::QSlotObject<void (CBasicThread::*)(), QtPrivate::List<>,
void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*)
/usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:418:17
#9 <#9>
0x7fc8e5f8a545 (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x2e4545)
#10 <#10>
0x7fc8e5d70c49 in QThread::started(QThread::QPrivateSignal)
(/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0xcac49)
#11 <#11>
0x7fc8e5d72b68 (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0xccb68)
#12 <#12>
0x7fc8e588dea6 in start_thread nptl/pthread_create.c:477:8
#13 <#13>
0x7fc8e5386dee in clone misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
0x602000808650 is located 0 bytes inside of 5-byte region
[0x602000808650,0x602000808655)
allocated by thread T36 (QThread) here:
#0 0x603ecd in malloc (/inst-clang-asan/bin/DyssolGUI+0x603ecd)
#1 <#1>
0x7fc8e5b4613f (/usr/lib/x86_64-linux-gnu/libhdf5_serial.so.103+0x29d13f)
Thread T36 (QThread) created by T0 here:
#0 0x5ee8fa in pthread_create (/inst-clang-asan/bin/DyssolGUI+0x5ee8fa)
#1 <#1>
0x7fc8e5d7264a in QThread::start(QThread::Priority)
(/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0xcc64a)
SUMMARY: AddressSanitizer: alloc-dealloc-mismatch
(/inst-clang-asan/bin/DyssolGUI+0x6344cd) in operator delete
<http://void*>
==2847510==HINT: if you don't care about these errors you may set
ASAN_OPTIONS=alloc_dealloc_mismatch=0
==2847510==ABORTING
`
It looks like this part
<https://github.com/FlowsheetSimulation/Dyssol-open/blob/master/HDF5Handler/H5Handler.cpp#L250>of
the code needs attention:
void CH5Handler::ReadData(const std::string& _sPath, const std::string&
_sDatasetName, std::vector<std::string>& _vData) const { _vData.clear();
StrType h5Datatype(PredType::C_S1, H5T_VARIABLE); const size_t nElemNum =
ReadSize(_sPath, _sDatasetName); if (nElemNum == 0) return; auto** buf =
new char*[nElemNum]; if (ReadStrings(_sPath, _sDatasetName, buf)) {
_vData.resize(nElemNum); for (size_t i = 0; i < nElemNum; ++i) _vData[i] =
buf[i]; } for (size_t i = 0; i < nElemNum; ++i) delete[] buf[i]; delete[]
buf; h5Datatype.close(); }
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#16>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABABXXBEPKDFWFLUM2FA43LTGI64RANCNFSM42DADDBA>
.
|
No, it does not help. Still the same issue. |
gladk
changed the title
Addresssanitizer: alloc-dealloc-mismatch crash after opening a saved simulation
Addresssanitizer: alloc-dealloc-mismatch (malloc vs operator delete []) after opening a saved simulation
Apr 1, 2021
Thanks, this commit really resolves the issue! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dyssol, compiled with AddressSanitizer crashes after opening any saved simulation with the following backtrace:
`=================================================================
==2847510==ERROR: AddressSanitizer: alloc-dealloc-mismatch (malloc vs operator delete []) on 0x602000808650
# 0 0x6344cd in operator delete (/inst-clang-asan/bin/DyssolGUI+0x6344cd)
# 1 0x7fc8e6c06f4a in CH5Handler::ReadData(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > >&) const /Dyssol-open/HDF5Handler/H5Handler.cpp:264:3
# 2 0x7fc8e6d2cbfc in CDistributionsGrid::LoadFromFile(CH5Handler&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) /Dyssol-open/ModelsAPI/DistributionsGrid.cpp:320:11
# 3 0x7fc8e6e33a30 in CFlowsheet::LoadFromFile_v3(CH5Handler&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) /Dyssol-open/SimulatorCore/Flowsheet.cpp:765:9
# 4 0x7fc8e6e321fc in CFlowsheet::LoadFromFile(CH5Handler&, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&) /Dyssol-open/SimulatorCore/Flowsheet.cpp:696:10
# 5 0x68ebec in CSaveLoadThread::StartTask() /Dyssol-open/DyssolMainWindow/SaveLoadThread.cpp:46:31
# 6 0x7dd940 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (CBasicThread::)()>::call(void (CBasicThread::)(), CBasicThread*, void**) /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:152:13
# 7 0x7dd878 in void QtPrivate::FunctionPointer<void (CBasicThread::)()>::call<QtPrivate::List<>, void>(void (CBasicThread::)(), CBasicThread*, void**) /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:185:13
# 8 0x7dd797 in QtPrivate::QSlotObject<void (CBasicThread::)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase, QObject*, void**, bool*) /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:418:17
# 9 0x7fc8e5f8a545 (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x2e4545)
# 10 0x7fc8e5d70c49 in QThread::started(QThread::QPrivateSignal) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0xcac49)
# 11 0x7fc8e5d72b68 (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0xccb68)
# 12 0x7fc8e588dea6 in start_thread nptl/pthread_create.c:477:8
# 13 0x7fc8e5386dee in clone misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
0x602000808650 is located 0 bytes inside of 5-byte region [0x602000808650,0x602000808655)
allocated by thread T36 (QThread) here:
# 0 0x603ecd in malloc (/inst-clang-asan/bin/DyssolGUI+0x603ecd)
# 1 0x7fc8e5b4613f (/usr/lib/x86_64-linux-gnu/libhdf5_serial.so.103+0x29d13f)
Thread T36 (QThread) created by T0 here:
# 0 0x5ee8fa in pthread_create (/inst-clang-asan/bin/DyssolGUI+0x5ee8fa)
# 1 0x7fc8e5d7264a in QThread::start(QThread::Priority) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0xcc64a)
SUMMARY: AddressSanitizer: alloc-dealloc-mismatch (/inst-clang-asan/bin/DyssolGUI+0x6344cd) in operator delete
==2847510==HINT: if you don't care about these errors you may set ASAN_OPTIONS=alloc_dealloc_mismatch=0
==2847510==ABORTING
`
It looks like this part of the code needs attention:
void CH5Handler::ReadData(const std::string& _sPath, const std::string& _sDatasetName, std::vector<std::string>& _vData) const { _vData.clear(); StrType h5Datatype(PredType::C_S1, H5T_VARIABLE); const size_t nElemNum = ReadSize(_sPath, _sDatasetName); if (nElemNum == 0) return; auto** buf = new char*[nElemNum]; if (ReadStrings(_sPath, _sDatasetName, buf)) { _vData.resize(nElemNum); for (size_t i = 0; i < nElemNum; ++i) _vData[i] = buf[i]; } for (size_t i = 0; i < nElemNum; ++i) delete[] buf[i]; delete[] buf; h5Datatype.close(); }
The text was updated successfully, but these errors were encountered: