SQLite Forum

Centos pre-thread db connection using WAL journal_mode
Login
Hello,

using C++.

I have a multi threaded application that is running on Centos. I am attempting to use a pre thread connection to a single db file. According to the documentation multiple connections to the same DB is supported. I am using the WAL journal_mode to allow atomic transactions and rollback support.

I have a testing app that ends up failing due to the journal_mode support seeming to not supported the same on the centos platform.

As part of initializing the journal_mode the sqlite3 code for unixLockSharedMemory calls ftruncate as part of some validation checking. 

sqlite3.c ln 38018. 

The first thread to arrive at this code succeeds and physical -shm and -wal files are created on disk for the db.

The next thread to arrive at this code fails with error code (22) `EINVAL The argument length is negative or larger than the maximum file size.` The comment around the call to ftruncate seems to indicate that the connection is assumed to be the first connection but this is actually the second.

This seems to indicate that the journal behavior does not support multiple connections to the same db file on the Centos platform. 

Any suggestions for how to properly set this up? Or should I change to a single connection per process?