in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

Issue: "The database file is locked"

Last post 06-07-2006 8:41 AM by Robert Simpson. 13 replies.
Page 1 of 1 (14 items)
Sort Posts: Previous Next
  • 05-24-2006 5:31 AM

    • Bull
    • Top 50 Contributor
    • Joined on 04-09-2006
    • Posts 30

    Issue: "The database file is locked"

    Dear all,

    First of all, I would like to thank you very much for providing this wrapper which helps me in the migration of the DB to SQLite.

    Now I have an issue with my application using SQLite via the ADO.NET 2.0. My application is a multi-thread one, so there are multi-access to the DB. After reading many posts, from your website / forums and others, I take care to:
    - use another connection objet in each thread. To do so, I have in my main thread a connection which is initialised and then cloned to be passed to the thread. So I always clone the connection
    - be sure that only one thread is modifying the database at the same time, but other can read it. To do so, I implement a semaphore object to allow only single access to the function which modify the database.

    However, I have sometimes messages "The database file is locked". What is strange is that this message appears when I try to read only the content of a table. To do so, I use a dataAdapter object to only fill the dataset: no update call.

    Could you please help me because I try to find a solution since few months, consulting many, many websites, but without success :(

    Thank you in advance for your kind help
    Best regards,
    Bull
  • 05-24-2006 6:32 AM In reply to

    Re: Issue: "The database file is locked"

    Can you get this to occur in the Visual Studio debugger?  If so, when the error happens, I'd like you to post the complete call stack of all the threads so I can see where each one was, and where it came from.

    You shouldn't have waited months before asking!  One thing you won't find on these forums is people complaining about me not responding to their questions :)

    Robert

     

  • 05-24-2006 9:10 AM In reply to

    • Bull
    • Top 50 Contributor
    • Joined on 04-09-2006
    • Posts 30

    Re: Issue: "The database file is locked"

     rsimpson wrote:

    Can you get this to occur in the Visual Studio debugger?

    Unfortunately, I am not using Visual Studio but VB Express. Do not know if I can do what you want with it. If so, could you explain how to do?

     rsimpson wrote:

    You shouldn't have waited months before asking!  One thing you won't find on these forums is people complaining about me not responding to their questions :)


    Well, I have the habit so search by myself before disturbing people. But you are right: I should have contacted you sooner.

    So thank you in advance for your precious help :)

    Bull
  • 05-24-2006 9:14 AM In reply to

    Re: Issue: "The database file is locked"

    VBExpress should be fine.  Run the application in the debugger.  When the error occurs and VB breaks, then you can go to the Debug menu and view the Call Stack and the Threads windows. As you click each thread, the call stack window will change. I need the complete call stack for each thread.

     

  • 05-24-2006 9:30 AM In reply to

    • Bull
    • Top 50 Contributor
    • Joined on 04-09-2006
    • Posts 30

    Re: Issue: "The database file is locked"

    I see the call stack but not the Threads window. Where can I activate it?

    It seems that there is not "Threads window" in the express edition (see this page). Am I right?
  • 05-24-2006 9:35 AM In reply to

    Re: Issue: "The database file is locked"

    Blah.  That blows.  Well, send me the call stack you have, and if I need more, I'll let you know.  If I do need more, I may need some kind of demo program that I can use to reproduce the bug on my version of VS.

    Robert

     

  • 05-25-2006 5:53 AM In reply to

    • Bull
    • Top 50 Contributor
    • Joined on 04-09-2006
    • Posts 30

    Re: Issue: "The database file is locked"

    Sorry for not replying sooner, but as you may know, that is always when we want to reproduce a bug that we can not succeed in :)

    So, Here is the call stack:

    RSS Xpress.exe!RSSXpress.DButilsOffline.LoadFeeds() Ligne 722    Basic
    RSS Xpress.exe!RSSXpress.UpdateFeed.updateFeed_rssatom(Integer idFeedToUpdate = 74) Ligne 206 + 0xa octets    Basic
    RSS Xpress.exe!RSSXpress.UpdateFeed.launchUpdateFeed() Ligne 138 + 0xc octets    Basic

    And it is stopping on the code line:
    dataAdapter.Fill(dataSet, "feeds")

    Is it the information you requested?
    Meanwhile, I am going to try to find among my friends somebody who have Visual Studio in case you need more information.

    Thanks again!
  • 05-25-2006 6:41 AM In reply to

    Re: Issue: "The database file is locked"

    Bummer.  Not quite enough information to go on.  I can either send you a debug build of the provider, or you can send me a debug build of your code and instructions on how to run it ...

     

  • 05-25-2006 6:54 AM In reply to

    • Bull
    • Top 50 Contributor
    • Joined on 04-09-2006
    • Posts 30

    Re: Issue: "The database file is locked"

    You can send me the debug version. Then, give me few days to find somebody with Visual Studio.

    Thanks
  • 06-02-2006 9:21 AM In reply to

    • pLu
    • Top 100 Contributor
    • Joined on 12-05-2005
    • Sweden
    • Posts 13

    Re: Issue: "The database file is locked"

    The Microsoft CLR Debugger included with Microsoft .NET Framework SDK v2.0 has both Threads and Call Stack windows. I think it's installed by default even with Visual Studio Express Edition.
  • 06-06-2006 7:46 AM In reply to

    Re: Issue: "The database file is locked"

    Is it possible that another program than your own is accessing your database file(s)? On the SQLite mailing list it was reported that sometimes other programs access files in exclusive mode which inhibits SQLite from properly functioning. One that was mentioned is the SVN client for Windows called TortoiseSVN which is in fact a Windows Shell Extension. I've personally experienced this problem using a background defragmentation program.

    /d
  • 06-07-2006 8:34 AM In reply to

    • pLu
    • Top 100 Contributor
    • Joined on 12-05-2005
    • Sweden
    • Posts 13

    Re: Issue: "The database file is locked"

    Some anti-virus programs are notorious for locking files. The slower the computer, the bigger the problem, in my experience. SQLite Check-in [3200] tries to solve the problem with locked journal files.
  • 06-07-2006 8:37 AM In reply to

    • Bull
    • Top 50 Contributor
    • Joined on 04-09-2006
    • Posts 30

    Re: Issue: "The database file is locked"

    Thank you for all your answers. Robert have solved this issue by providing me a new version of SQLite.NET.

    Thank you very much again Robert :)
  • 06-07-2006 8:41 AM In reply to

    Re: Issue: "The database file is locked"

    We've worked through the solution via e-mail and an official release of 1.0.30 is still pending other changes that I need to make in addition to supporting 3.3.6.

    Bull uncovered a couple bugs in the .NET wrapper dealing with multiple threads and locking.  In some cases the wrapper was throwing a SQLITE_BUSY/LOCKed error, ignoring the CommandTimeout value, and not retrying the command.

    Robert

     

Page 1 of 1 (14 items)
Powered by Community Server (Commercial Edition), by Telligent Systems