mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 16:48:19 +00:00
change sqlite3 default threading mode to no-mutex, disable memory
statistics, finalize prepared statement before exitting logger. This might fix the deadlock issue, at least it did not happen for me on my tried on the test system where it happened quite regularly before.
This commit is contained in:
parent
945aa8a550
commit
bd02da8a0c
3 changed files with 10 additions and 3 deletions
3
src/3rdparty/sqlite3.c
vendored
3
src/3rdparty/sqlite3.c
vendored
|
@ -1,3 +1,6 @@
|
||||||
|
# define SQLITE_THREADSAFE 2
|
||||||
|
# define SQLITE_DEFAULT_MEMSTATUS 0
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
** This file is an amalgamation of many separate C source files from SQLite
|
** This file is an amalgamation of many separate C source files from SQLite
|
||||||
** version 3.7.16.2. By combining all the individual C code files into this
|
** version 3.7.16.2. By combining all the individual C code files into this
|
||||||
|
|
|
@ -35,13 +35,16 @@ SQLite::SQLite(WriterFrontend* frontend) : WriterBackend(frontend)
|
||||||
|
|
||||||
db = 0;
|
db = 0;
|
||||||
io = new AsciiFormatter(this, AsciiFormatter::SeparatorInfo(set_separator, unset_field, empty_field));
|
io = new AsciiFormatter(this, AsciiFormatter::SeparatorInfo(set_separator, unset_field, empty_field));
|
||||||
|
st = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SQLite::~SQLite()
|
SQLite::~SQLite()
|
||||||
{
|
{
|
||||||
if ( db != 0 )
|
if ( db != 0 )
|
||||||
{
|
{
|
||||||
sqlite3_close(db);
|
sqlite3_finalize(st);
|
||||||
|
if ( !sqlite3_close(db) )
|
||||||
|
Error("Sqlite could not close connection");
|
||||||
db = 0;
|
db = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,8 +113,9 @@ private:
|
||||||
|
|
||||||
inline static void safe_lock(pthread_mutex_t* mutex)
|
inline static void safe_lock(pthread_mutex_t* mutex)
|
||||||
{
|
{
|
||||||
if ( pthread_mutex_lock(mutex) != 0 )
|
int res = pthread_mutex_lock(mutex);
|
||||||
reporter->FatalErrorWithCore("cannot lock mutex");
|
if ( res != 0 )
|
||||||
|
reporter->FatalErrorWithCore("cannot lock mutex: %d(%s)", res, strerror(res));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static void safe_unlock(pthread_mutex_t* mutex)
|
inline static void safe_unlock(pthread_mutex_t* mutex)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue