I sent this hours ago, never saw it on the list.



________________________________
 From: Jason H <scorp...@yahoo.com>
To: "witty-interest@lists.sourceforge.net" 
<witty-interest@lists.sourceforge.net> 
Sent: Wednesday, September 5, 2012 10:37 AM
Subject: Re: [Wt-interest] database locked
 

It may be a SQLite limitation. 

Remeber Sqlite is multi-process aware and not multi-thread aware. (* there is 
some multithread support)
Qt has a limitation that you must destroy the query object (QSqlQuery) 
especially on writes otherwise you'll get a journal file, the app will quit, 
and you'll have the problem of the journal file gets removed (not committed) on 
next invocation of the program. The data looks like it is there until it 
restarts.

Now, I have seen this SQLite message on Windows, again, in Qt when frequently 
reading/writing the database, opening it each time for the transaction. I 
*think* I fixed it by just retrying since it was not mission-critical and for 
debugging info. I think the proper mechanism would be a mutex-protected object 
that services the database. 

I would suggest
 trying a different database (PostgreSQL or *shudder* MySQL) and see if those 
return a similar error.




________________________________
 From: Nagaev Boris <bnag...@gmail.com>
To: witty-interest@lists.sourceforge.net 
Sent: Sunday, September 2, 2012 6:53 PM
Subject: Re: [Wt-interest] database locked
 
Hello!

I am not sure that the bug is confirmed.
This exception is thrown sometimes by my application.
But I can't find out the reason or reproduce it in test case.

I created test case: http://ideone.com/rMxZC
Simple application with AuthWidget.
When login.changed() is emitted, new record is added to User table.
But it works fine, no exceptions are thrown (they are expected, if it does bug).
Could you modify it to produce the exception?

On Mon, Sep 3, 2012 at 1:53 AM, Offirmo <offirmo....@gmail.com> wrote:
> Didn't know of the WServer::post() method. This is just the clean way to
> do it, thanks !
>
> My app is ~50 files for now, so I can't send a simple example. But since
> you were able to reproduce it, I think it's confirmed.
>
> Now up to an expert to find the pending Dbo session and
 close it before
> calling the auth callback.
>
>
>
> Le 02/09/2012 16:57, Nagaev Boris a écrit :
>> Hello!
>>
>> I am listening on login.changed() and get this exception.
>> As workaround, I re-try database actions afterwards, using WServer::post()
>> However, I am not sure that it is a bug of Wt, not of my app.
>> Could you send complete .cpp file with test reproducing this bug?
>>
>> On Sun, Sep 2, 2012 at 6:15 PM, Offirmo <offirmo....@gmail.com> wrote:
>>> So, is any experienced Wt dev confirming this is a Wt bug ?
>>>
>>>
>>> Le 26/08/2012 20:27, Offirmo a écrit :
>>>
>>> So, after tinkering myself, I found some explanations and, maybe, a Wt bug.
>>>
>>> It happen
 that I am using the auth module described in the auth tutorial. (I
>>> use Wt latest from git)
>>>
>>> I have this line :
>>>
>>> session_.login().changed().connect(this, &AuthApplication::authEvent);
>>>
>>> and then the auth event occur (I register a new account).
>>>
>>> authEvent() get executed. And it strongly seems that there is a pending
>>> write transaction in progress from the auth code at this time !
>>>
>>> So I cannot write anything in database inside the authEvent() callback,
>>> which is very annoying. Isn't it usual, when a user is created, to create
>>> some tables for him ?
>>>
>>> I have temporarily solved the problem by using two databases : one for auth
>>> and one for my datas. It works this way, the pending auth transaction
 don't
>>> disturb my own data.
>>>
>>> May I suggest this is a Wt bug, to have a pending transaction when calling
>>> the session_.login().changed() callback ?
>>>
>>> Best regards.
>>>
>>>
>>>
>>> Le 26/08/2012 14:56, Offirmo a écrit :
>>>
>>> Hello all,
>>>
>>> I'm still working on my Wt app and who knows, maybe I'll have something to
>>> show you one day ?
>>>
>>> But for the moment, I'm stuck with this error :
>>> [error] "Wt: error during event handling: Sqlite3: insert into ""real_user""
>>> (""version"", ""email"", ""creation_date"", ""last_modif_date"",
>>> ""sti_type"", ""denomination"") values (?, ?, ?, ?, ?, ?): database is
>>> locked"
>>> [error] "Wt: fatal error: Sqlite3: insert
 into ""real_user"" (""version"",
>>> ""email"", ""creation_date"", ""last_modif_date"", ""sti_type"",
>>> ""denomination"") values (?, ?, ?, ?, ?, ?): database is locked"
>>>
>>> I've looked a bit on google and I understand that it *may* mean that there
>>> is another pending SQL request on the same data. But I can't find such thing
>>> in my app (which is quite simple at that time).
>>>
>>> To remove most possibilites, the code that gives this error is now very
>>> short :
>>>
>>>      // then add it to db
>>>      {
>>>          // again, in its own transaction
>>>          Wt::Dbo::Transaction transaction(dbo_session);
>>>          element_ptr =
 dbo_session.add(p);
>>>          transaction.commit();
>>>      }
>>>
>>> Do you have any clue on what may cause this "database is locked" error ? I'm
>>> stuck...
>>>
>>> Thanks.
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Live Security Virtual Conference
>>> Exclusive live event will cover all the ways today's security and
>>> threat landscape has changed and how IT managers can respond. Discussions
>>> will include endpoint security, mobile security and the latest in malware
>>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>>
 _______________________________________________
>>> witty-interest mailing list
>>> witty-interest@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/witty-interest
>>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> witty-interest mailing list
>> witty-interest@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> witty-interest mailing list
> witty-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/witty-interest

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to