I found
#define SQLITE_MISUSE 21
in the SQLite C / C ++ documentation.
This error may occur if one or more of the SQLite API procedures is incorrect. Examples of improper use include calling sqlite_exec after closing the database using sqlite_close or calling sqlite_exec with the same database pointer at the same time as two separate threads.
I would suggest that your code incorrectly calls the interface library around line 95716.
Later.,.
The OP confirmed that the actual problem is that two threads are accessing the database at the same time, one is trying to write to db, and the other is trying to close it. I would conclude that there was an offensive line of code 95716 in the emulator. (Because the OP code base had only 1000 lines or less.)
source share