On Mar 4, 2009, at 8:31 AM, Marcus Grimm wrote:

> Richard,
> Thanks for looking into this.
>
> I've placed some debug output in the sqlite2_step function
> and I found that it returns SQLITE_MISUSE here:
>
> --
>   static int sqlite3Step(Vdbe *p){
>   sqlite3 *db;
>   int rc;
>
>   assert(p);
>   if( p->magic!=VDBE_MAGIC_RUN )
>   {
>     return SQLITE_MISUSE;
>   }
> --

What is the value of p->magic at the point of failure?  (In hex, please)

>
>
> I have no idea what this MAGIC_RUN means.
>
> Does it indicate that infact I'm using an allready released  
> statement ?
>
> Please note that I'm not able to reproduce the problem when
> I switch the shared cache off.
>
> Thank you
>
> Kind regards
>
> Marcus Grimm
>
>
> D. Richard Hipp wrote:
>> On Mar 4, 2009, at 5:19 AM, Marcus Grimm wrote:
>>
>>> Hi all,
>>>
>>> I'm doing a little stress test on a server application and run into
>>> a problem when two threads are trying to access the database.
>>> Here is the background:
>>> 1. shared cache is enabled prior open any DB connection.
>>> 2. Each thread then opens a DB connection.
>>> 3. Thread A just reads table entries continuosly by
>>>   doing sqlite3_prepare_v2 and followed by some sqlite3_step to
>>> parse the result set.
>>>   He then uses sqlite3_finalize and after a few ms he repeats
>>> everything.
>>> 4. Thread B is triggered to update or insert some a new values
>>>   in some tables.
>>>   To do so I obtain an EXCLUSIVE transaction, do the insert/update
>>> and COMIT.
>>>
>>> Now, a problem arises occasionally that thread A gets an
>>> SQLITE_MISUSE when
>>> trying to call sqlite3_step, most likely because thread B currently
>>> writes into
>>> the DB, I guess.
>>>
>>> Now, my question:
>>>
>>> How to handle the SQLITE_MISUSE ?
>>
>> My guess is that the SQLITE_MISUSE is being returned because you are
>> calling sqlite3_step() with a statement that has already been
>> destroyed by sqlite3_finalize().
>>
>>
>> D. Richard Hipp
>> d...@hwaci.com
>>
>>
>>
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>
> -- 
> Marcus Grimm, MedCom GmbH Darmstadt, Rundeturmstr. 12, 64283 Darmstadt
> Tel: +49(0)6151-95147-10
> Fax: +49(0)6151-95147-20
> --------------------------------------------------
> MedCom slogans of the month:
> "Vacation ? -- Every day at MedCom is a paid vacation!"
> "Friday I have monday in my mind."
> "MedCom -- Every week a vacation, every day an event, every hour a  
> cliffhanger,
>            every minute a climax."
> "Damned, it's weekend again!"
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

D. Richard Hipp
d...@hwaci.com



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to