On Windows:
tl; dr: try opening the file again.
Our system suffered from this problem, and it was definitely not a permission problem, since the program itself could open the database as many times as possible from many streams, but sometimes (only on Windows, not OSX), the stream would get these errors, although all other threads in the program did not have any difficulties.
In the end, we found that the downstream flows were only those that tried to open the database immediately after another thread closed it (within 3 ms). We suggested that the problem is that Windows (or the sqlite implementation under windows) does not always immediately clear file resources after closing the file. We got around this by running a test write request to db on opening (for example, creating then dropping a table with a dumb name). If creation / crash did not succeed, we waited 50 ms and tried again, repeating until it was executed, or 5 seconds passed.
It worked; apparently, it just needed enough time for the resources to get them to disk.
Steve Broberg Jun 22 '17 at 21:32 2017-06-22 21:32
source share