On 14 Apr 2017, at 10:53pm, Paul Egli <[email protected]> wrote:

> On the "how to corrupt" page ( http://sqlite.org/howtocorrupt.html ) i
> do not see any mention of using SQLite in an incorrect way with
> respect to thread safety. Is there really no way that, for example,
> using the same connection on multiple threads at the same time could
> either (a) corrupt the database, or (b) lead to a false reports of
> corruption?

Not unless you’re also violating one of the other things mentioned on that 
page.  SQLite implements mutex locking internally.  It is meant to prevent 
itself from messing up in the way you describe.

Please have their program execute

        PRAGMA compile_options;

and tell us any lines which include "THREAD" especially "SQLITE_THREADSAFE".  
If this is set to zero you can have problems, because that copy of SQLite was 
compiled to omit thread safety code.  But this is not a default option and you 
should not be seeing it unless you did it on purpose.

You should probably read <https://sqlite.org/threadsafe.html>.

> […]
> 
> They also routinely see "cannot start a transaction within a
> transaction" even though there is no obvious place where or reason why
> that would happen in their code. This leads us to believe they may be
> using the same connection on multiple threads.

I agree with your analysis, on what I know so far.  Have each program using 
SQLite execute

        sqlite3_config(SQLITE_CONFIG_MULTITHREAD)

/before it does any other SQLite call including sqlite3_initialize()/.  See 
whether that makes the problem go away.

Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to