3

I've gotten the following error in the log files of my emulator and I don't know what to make of it because a google search turns up nothing.

03-12 12:53:28.782: INFO/Database(688): sqlite returned: error code = 21, 
  msg = misuse detected by source line 95716
03-12 12:53:28.812: ERROR/Database(688): sqlite_config failed error_code = 21. 
  THIS SHOULD NEVER occur.

1 Answer 1

8

I found

#define SQLITE_MISUSE      21   /* Library used incorrectly */

in the SQLite C/C++ interface documentation.

This error might occur if one or more of the SQLite API routines is used incorrectly. Examples of incorrect usage include calling sqlite_exec after the database has been closed using sqlite_close or calling sqlite_exec with the same database pointer simultaneously from two separate threads.

I'd guess that means your code is calling the interface library incorrectly around line 95716.

Later . . .

The OP confirmed that the actual problem involved two threads accessing the database at the same time, one trying to write to the db, and the other trying to close it. I'd infer from this that the offending line of code, 95716, was in the emulator. (Because the OP's code base had only 1000 lines or less.)

Sign up to request clarification or add additional context in comments.

7 Comments

That's just it though. There is no line 95716 because my code base is barely 1000 lines long. But your comment has pointed me in the right direction because I do have some threads working with the database but they each handle their own connections so I'll have to look a little more closely at that code.
Hmmm. Could it be referring to line 95716 in the emulator source? Can you switch to a different emulator for testing that idea?
I opted to use a lock when closing the database so that two calls don't contend for opening and closing a database. I think this should fix any future problems.
If that works, you should write it up as an answer, and accept it.
@Catcall: You pointed me in the right direction so I don't mind if you take my comment and add to your answer so other people can be directed to the proper problem area along with a possible hint for the solution because you deserve the credit, not me.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.