Have you run a memory test on your system?  Random failings when working 
hard is a classic symptom of dodgy memory (launching Firefox may cause 
memory to be allocated for SQLite elsewhere than when there's nothing 
else running).

I once had a system that would segfault in the C compiler in similar 
circumstances.  It was faulty memory.

Christopher Sansone wrote:
> Hi everyone,
> 
> I'm hoping someone can help with a strange issue I'm having.  I have a 
> SQLite application that runs a some modest SQL scripts (~750KB) to 
> create and populate a database.  For the same exact script, sometimes it 
> works perfectly and other times it fails with a SQLITE_ERROR.  When it 
> fails, it fails on a different statement each time, so it does not seem 
> to be a problem with the SQL script itself.
> 
> Upon further testing, I noticed that it seems to work when my system is 
> otherwise idle, but if something else is going on, it fails.  For 
> instance, if I perform a task like launching Firefox while the script is 
> running, it errors out every single time.
> 
> My application is single-threaded, and the basic pseudo-code is as follows:
> 
> repeat
>   sqlite3_prepare(db, sql, -1, p, sql);
>   repeat
>     s := sqlite3_step(p);
>   until
>     s in (SQLITE_DONE, SQLITE_ERROR, SQLITE_MISUSE);
>   sqlite3_finalize(p);
> until
>   sql is null;
> 
> As it should, sqlite3_prepare() provides a single statement to be 
> executed, and sqlite3_step() performs the execution of the single 
> statement.  The error specifically occurs in sqlite3_step().
> 
> Does anyone have any ideas of why this is occurring?  My best guess is 
> that it is a thread-safety issue inside SQLite... the statements are 
> being executed asynchronously and failing when one statement does not 
> execute fast enough.  I am running the pre-compiled build for Windows 
> that I downloaded right from the sqlite website.  Does anyone know what 
> threading mode it was compiled with and whether or not that would be a 
> problem?  Any other ideas?
> 
> Thanks so much in advance!
> 
> Cheers,
> Christopher
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 

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

Reply via email to