SQLite Forum

SQLIte 3.37.0 breaks SQLITE_OPEN_NOMUTEX - TSAN failure
Login
Your forum doesn't appear to support attaching files, so I've saved the attachment on my own bug tracking system (which has wide open public read access).

<https://stroika.atlassian.net/browse/STK-753> (*note this valgrind output contains misleading warnings about the stdc++ atomics library - just ignore these).


But in case you have trouble accessing that - I will paste a small subset with the highlights here..

~~~~~
==661746==  Lock at 0x5C7C278 was first observed
==661746==    at 0x4C39F2A: pthread_mutex_init (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
==661746==    by 0x9BDC36: pthreadMutexAlloc (sqlite3.c:27382)
==661746==    by 0x9BD5E0: sqlite3MutexAlloc (sqlite3.c:26902)
==661746==    by 0x9F1C75: sqlite3BtreeOpen (sqlite3.c:68144)
==661746==    by 0xAD13E4: openDatabase (sqlite3.c:169926)
==661746==    by 0xAD1745: sqlite3_open_v2 (sqlite3.c:170049)
==661746==    by 0x454A22: Stroika::Foundation::Database::SQL::SQLite::Connection::Rep_::Rep_(Stroika::Foundation::Database::SQL::SQLite::Options const&) (SQLite.cpp:203)


==661746==  Lock at 0x5C4EB88 was first observed
==661746==    at 0x4C39F2A: pthread_mutex_init (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
==661746==    by 0x9BDC36: pthreadMutexAlloc (sqlite3.c:27382)
==661746==    by 0x9BD5E0: sqlite3MutexAlloc (sqlite3.c:26902)
==661746==    by 0x9F1C75: sqlite3BtreeOpen (sqlite3.c:68144)
==661746==    by 0xAD13E4: openDatabase (sqlite3.c:169926)
==661746==    by 0xAD1745: sqlite3_open_v2 (sqlite3.c:170049)
==661746==    by 0x454B5C: Stroika::Foundation::Database::SQL::SQLite::Connection::Rep_::Rep_(Stroika::Foundation::Database::SQL::SQLite::Options const&) (SQLite.cpp:209)
==661746==    by 0x460746: void __gnu_cxx::new_allocator<Stroika::Foundation::Database::SQL::SQLite::Connection::Rep_>::construct<Stroika::Foundation::Database::SQL::SQLite::Connection::Rep_, Stroika::Foundation::Database::SQL::SQLite::Options const&>(Stroika::Foundation::Database::SQL::SQLite::Connection::Rep_*, Stroika::Foundation::Database::SQL::SQLite::Options const&) (new_allocator.h:136)
==661746==    by 0x45FB07: void std::allocator_traits<std::allocator<Stroika::Foundation::Database::SQL::SQLite::Connection::Rep_> >::construct<Stroika::Foundation::Database::SQL::SQLite::Connection::Rep_, Stroika::Foundation::Database::SQL::SQLite::Options const&>(std::allocator<Stroika::Foundation::Database::SQL::SQLite::Connection::Rep_>&, Stroika::Foundation::Database::SQL::SQLite::Connection::Rep_*, Stroika::Foundation::Database::SQL::SQLite::Options const&) (alloc_traits.h:475)
==661746==    by 0x45ED3F: std::_Sp_counted_ptr_inplace<Stroika::Foundation::Database::SQL::SQLite::Connection::Rep_, std::allocator<Stroika::Foundation::Database::SQL::SQLite::Connection::Rep_>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<Stroika::Foundation::Database::SQL::SQLite::Options const&>(std::allocator<Stroika::Foundation::Database::SQL::SQLite::Connection::Rep_>, Stroika::Foundation::Database::SQL::SQLite::Options const&) (shared_ptr_base.h:545)


==661746== Possible data race during read of size 4 at 0x149FE78 by thread #3
==661746== Locks held: 1, at address 0x5C7C278
==661746==    at 0xAC9E08: keywordCode (sqlite3.c:165359)
==661746==    by 0xACB253: sqlite3GetToken (sqlite3.c:165813)
==661746==    by 0xACB6B4: sqlite3RunParser (sqlite3.c:165914)
==661746==    by 0xA82D0D: sqlite3Prepare (sqlite3.c:132931)
==661746==    by 0xA83021: sqlite3LockAndPrepare (sqlite3.c:133006)
==661746==    by 0xA833A7: sqlite3_prepare_v2 (sqlite3.c:133091)
==661746==    by 0x455E54: Stroika::Foundation::Database::SQL::SQLite::Statement::MyRep_::MyRep_(Stroika::Foundation::Database::SQL::SQLite::Connection::Ptr const&, Stroika::Foundation::Characters::String const&) (SQLite.cpp:367)

==661746== This conflicts with a previous write of size 4 by thread #2
==661746== Locks held: 1, at address 0x5C4EB88
==661746==    at 0xA26AC8: sqlite3VdbeExec (sqlite3.c:90711)
==661746==    by 0xA1957E: sqlite3Step (sqlite3.c:85145)
==661746==    by 0xA19896: sqlite3_step (sqlite3.c:85202)
==661746==    by 0x457150: Stroika::Foundation::Database::SQL::SQLite::Statement::MyRep_::GetNextRow() (SQLite.cpp:500)
~~~~~

Please let me know if you need more information to fix this. I'm happy to help.
               Lewis.