Ocilib Crashing at Multithreading data race #359
Replies: 8 comments 5 replies
-
================================================================= 2024-04-30 02:24:33.082 stressTool:=> 0(471 ms) 0x6040004ea230 is located 32 bytes inside of 48-byte region [0x6040004ea210,0x6040004ea240) previously allocated by thread T162 here: SUMMARY: AddressSanitizer: heap-use-after-free /opt/rh/gcc-toolset-13/root/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/stl_tree.h:2226:44 in std::_Rb_tree<void*, std::pair<void* const, ocilib::core::Handle*>, std::_Select1st<std::pair<void* const, ocilib::core::Handle*>>, std::less<void*>, std::allocator<std::pair<void* const, ocilib::core::Handle*>>>::_M_get_insert_hint_unique_pos(std::_Rb_tree_const_iterator<std::pair<void* const, ocilib::core::Handle*>>, void* const&) |
Beta Was this translation helpful? Give feedback.
-
Hi @vrogier , Any guidance on this issue will be helpful. Thanks |
Beta Was this translation helpful? Give feedback.
-
Hi, Did you use the flag Environment::Threaded when calling Environment::Initialize() ? Regards, Vincent |
Beta Was this translation helpful? Give feedback.
-
Hi @vrogier , Yes I am setting the flag in Environment initialization Environment::Initialize(Environment::Threaded); |
Beta Was this translation helpful? Give feedback.
-
[Thread debugging using libthread_db enabled] |
Beta Was this translation helpful? Give feedback.
-
Hi @vrogier At the compilation, I got a lot of compilation error, using Clang 17 compiler In file included from C:\ocilib\include\ocilib.hpp:167: |
Beta Was this translation helpful? Give feedback.
-
bty, what version of OCILIB are you using ? |
Beta Was this translation helpful? Give feedback.
-
can you provide a some test code that reproduces the issue that I can try? thanks |
Beta Was this translation helpful? Give feedback.
-
Hi @vrogier ,
I am working on the stress tool to connect to oracle db and manipulate data. But at the stress test, I am hit with a tool crashing in Linux with a segmentation fault.
I am creating 100 threads and each thread does a bunch of SQL query.
I have written a wrapper class TOraResultSet which encapsulates ocilib::Statment and ocilib::ResultSet as unique_ptr and TOraConn which returns this TOraResultSet pointer to where its called.
Can you please guide or help with what could be wrong with ocilib?
WARNING: ThreadSanitizer: data race (pid=64363)
Write of size 8 at 0x7b0c001556b0 by thread T57:
#0 operator delete(void*) ??:? (stressTool+0x6cd997) (BuildId: 997bd6ac0a4bc24a)
#1 std::__new_allocator<std::_Rb_tree_node<std::pair<void* const, ocilib::core::Handle*> > >::deallocate(std::_Rb_tree_node<std::pair<void* const, ocilib::core::Handle*> >, unsigned long) /opt/rh/gcc-toolset-13/root/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/new_allocator.h:168 (stressTool+0x9e2d7d) (BuildId: 997bd6ac0a4bc24a)
#2 std::_Rb_tree<void, std::pair<void* const, ocilib::core::Handle*>, std::_Select1st<std::pair<void* const, ocilib::core::Handle*> >, std::less<void*>, std::allocator<std::pair<void* const, ocilib::core::Handle*> > >::_M_put_node(std::_Rb_tree_node<std::pair<void* const, ocilib::core::Handle*> >) /opt/rh/gcc-toolset-13/root/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/alloc_traits.h:516 (stressTool+0x9e2c89) (BuildId: 997bd6ac0a4bc24a)
#3 std::_Rb_tree<void, std::pair<void* const, ocilib::core::Handle*>, std::_Select1st<std::pair<void* const, ocilib::core::Handle*> >, std::less<void*>, std::allocator<std::pair<void* const, ocilib::core::Handle*> > >::_M_put_node(std::_Rb_tree_node<std::pair<void* const, ocilib::core::Handle*> >) /opt/rh/gcc-toolset-13/root/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/stl_tree.h:567 (stressTool+0x9e2c89)
#4 std::_Rb_tree<void, std::pair<void* const, ocilib::core::Handle*>, std::_Select1st<std::pair<void* const, ocilib::core::Handle*> >, std::less<void*>, std::allocator<std::pair<void* const, ocilib::core::Handle*> > >::_M_drop_node(std::_Rb_tree_node<std::pair<void* const, ocilib::core::Handle*> >) /opt/rh/gcc-toolset-13/root/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/stl_tree.h:634 (stressTool+0x9e2b96) (BuildId: 997bd6ac0a4bc24a)
#5 std::_Rb_tree<void, std::pair<void* const, ocilib::core::Handle*>, std::_Select1st<std::pair<void* const, ocilib::core::Handle*> >, std::less<void*>, std::allocator<std::pair<void* const, ocilib::core::Handle*> > >::_M_erase_aux(std::_Rb_tree_const_iterator<std::pair<void* const, ocilib::core::Handle*> >) /opt/rh/gcc-toolset-13/root/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/stl_tree.h:2496 (stressTool+0x9e652e) (BuildId: 997bd6ac0a4bc24a)
#6 std::_Rb_tree<void*, std::pair<void* const, ocilib::core::Handle*>, std::_Select1st<std::pair<void* const, ocilib::core::Handle*> >, std::less<void*>, std::allocator<std::pair<void* const, ocilib::core::Handle*> > >::_M_erase_aux(std::_Rb_tree_const_iterator<std::pair<void* const, ocilib::core::Handle*> >, std::_Rb_tree_const_iterator<std::pair<void* const, ocilib::core::Handle*> >) /opt/rh/gcc-toolset-13/root/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/stl_tree.h:2510 (stressTool+0x9e62b7) (BuildId: 997bd6ac0a4bc24a)
#7 std::_Rb_tree<void*, std::pair<void* const, ocilib::core::Handle*>, std::_Select1st<std::pair<void* const, ocilib::core::Handle*> >, std::less<void*>, std::allocator<std::pair<void* const, ocilib::core::Handle*> > >::erase(void* const&) /opt/rh/gcc-toolset-13/root/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/stl_tree.h:2521 (stressTool+0x9e5ed9) (BuildId: 997bd6ac0a4bc24a)
#8 std::map<void*, ocilib::core::Handle*, std::less<void*>, std::allocator<std::pair<void* const, ocilib::core::Handle*> > >::erase(void* const&) /opt/rh/gcc-toolset-13/root/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/stl_map.h:1119 (stressTool+0x9e5e15) (BuildId: 997bd6ac0a4bc24a)
#9 ocilib::core::ConcurrentMap<void*, ocilib::core::Handle*>::Remove(void*) /var/tmp/src/5d9f5440-4230-4110-8851-ab022d943008/Alma-OpenSSL3/ocilib/include/ocilibcpp/detail/core/ConcurrentMap.hpp:48 (stressTool+0x9e4114) (BuildId: 997bd6ac0a4bc24a)
#10 void ocilib::core::HandleStore::Set<ocilib::core::HandleHolder<OCI_Statement*>::SmartHandle*>(void*, ocilib::core::HandleHolder<OCI_Statement*>::SmartHandle*) /var/tmp/src/5d9f5440-4230-4110-8851-ab022d943008/Alma-OpenSSL3/ocilib/include/ocilibcpp/detail/core/HandleStore.hpp:49 (stressTool+0xa7432f) (BuildId: 997bd6ac0a4bc24a)
#11 ocilib::core::HandleHolder<OCI_Statement*>::SmartHandle::Destroy() /var/tmp/src/5d9f5440-4230-4110-8851-ab022d943008/Alma-OpenSSL3/ocilib/include/ocilibcpp/detail/core/SmartHandle.hpp:80 (stressTool+0xa74965) (BuildId: 997bd6ac0a4bc24a)
#12 ~SmartHandle /var/tmp/src/5d9f5440-4230-4110-8851-ab022d943008/Alma-OpenSSL3/ocilib/include/ocilibcpp/detail/core/SmartHandle.hpp:63 (stressTool+0xa74448) (BuildId: 997bd6ac0a4bc24a)
#13 ~SmartHandle /var/tmp/src/5d9f5440-4230-4110-8851-ab022d943008/Alma-OpenSSL3/ocilib/include/ocilibcpp/detail/core/SmartHandle.hpp:62 (stressTool+0xa744e9) (BuildId: 997bd6ac0a4bc24a)
#14 ocilib::core::HandleHolder<OCI_Statement*>::SmartHandle::Release(ocilib::core::HandleHolder<OCI_Statement*>) /var/tmp/src/5d9f5440-4230-4110-8851-ab022d943008/Alma-OpenSSL3/ocilib/include/ocilibcpp/detail/core/SmartHandle.hpp:144 (stressTool+0xa73250) (BuildId: 997bd6ac0a4bc24a)
#15 ocilib::core::HandleHolder<OCI_Statement>::Release() /var/tmp/src/5d9f5440-4230-4110-8851-ab022d943008/Alma-OpenSSL3/ocilib/include/ocilibcpp/detail/core/HandleHolder.hpp:158 (stressTool+0xa72c8c) (BuildId: 997bd6ac0a4bc24a)
#16 ~HandleHolder /var/tmp/src/5d9f5440-4230-4110-8851-ab022d943008/Alma-OpenSSL3/ocilib/include/ocilibcpp/detail/core/HandleHolder.hpp:45 (stressTool+0xa729f5) (BuildId: 997bd6ac0a4bc24a)
#17 ~Statement /var/tmp/src/5d9f5440-4230-4110-8851-ab022d943008/Alma-OpenSSL3/ocilib/include/ocilibcpp/types.hpp:5558 (stressTool+0xa63b85) (BuildId: 997bd6ac0a4bc24a)
#18 std::default_deleteocilib::Statement::operator()(ocilib::Statement*) const /opt/rh/gcc-toolset-13/root/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/unique_ptr.h:99 (stressTool+0xa76e63) (BuildId: 997bd6ac0a4bc24a)
#19 ~unique_ptr /opt/rh/gcc-toolset-13/root/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/unique_ptr.h:404 (stressTool+0xa606a2) (BuildId: 997bd6ac0a4bc24a)
#20 ~TMyOracleResult /var/tmp/src/5d9f5440-4230-4110-8851-ab022d943008/Alma-OpenSSL3/ocilib/classTMyOracle.h:48 (stressTool+0xa6485c) (BuildId: 997bd6ac0a4bc24a)
#21 ~TMyOracleResult /var/tmp/src/5d9f5440-4230-4110-8851-ab022d943008/Alma-OpenSSL3/ocilib/classTMyOracle.h:48 (stressTool+0xa648a9) (BuildId: 997bd6ac0a4bc24a)
#22 std::default_delete::operator()(TISQLResult*) const /opt/rh/gcc-toolset-13/root/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/unique_ptr.h:99 (stressTool+0x70864d) (BuildId: 997bd6ac0a4bc24a)
#23 ~unique_ptr /opt/rh/gcc-toolset-13/root/usr/lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/unique_ptr.h:404 (stressTool+0x706a52) (BuildId: 997bd6ac0a4bc24a)
Beta Was this translation helpful? Give feedback.
All reactions