SQLite Forum

SQLite in-memory database encounters SQLITE_LOCKED_SHAREDCACHE intermittently
Login
Thanks Larry and Dan for your replies. It's very helpful for me to know the problem better. 

I finally located the root cause for this issue by myself. And I share it below in case anyone else comes across similar issue in the future. For the workaround, it's highly appreciated that if there is better one. 

First of all, my program does have multiple threads, but only one thread is inserting data, others are reading data and there is no problem of that. The unexpected thing we fail to think of is the reading thread would incur a **begin intermediate** operation to change the setting of **autoCommit** thus causing contention and inevitable winners and losers thereafter. 

I share the link below since there are screenshots to illustrate this issue detailedly and I find no good way to organize them here.

[workaround](https://stackoverflow.com/questions/63361787/sqlite-in-memory-database-encounters-sqlite-locked-sharedcache-intermittently/64461243#64461243)