Menu

Deadlock Problem

Help
2007-09-26
2013-04-09
  • Adair Vargas

    Adair Vargas - 2007-09-26

    I had a question. How can I implement the functions to detect an release deadlock in the DB?. I only have one program with an object accesing only one database, but if I stop the debug in the IDE, when I run again my app I can't be able to re open DB (a pause in the executions put the cursor of debuf in DB->open in the library).
    When i try to use the methods of the env object this return me a invalid argument exception.

     
    • Karl Waclawek

      Karl Waclawek - 2007-09-26

      I don't think you have a deadlock, but a corruption. This happens when you stop the process while writing to the database. You need to run recovery, or open the environment with recovery turned on. Are the demo projects not doing this already?

       
    • Adair Vargas

      Adair Vargas - 2007-09-26

      The recovery flag is set when the program is first runned (we need to keep a track of the operations everyday, so we create a new directory for each day), but if the environment exist, we open it a none flag. We tried to open this with any other flag, but always return an "Invalid argument" error. We have many objects writing in to one file/database for each one, but all of them uses the same environment. if we put the flags like the examples for each of the objects, return a Critical error sayin we need to run the recovery (even if the directory is freshlly created).

       
      • Karl Waclawek

        Karl Waclawek - 2007-09-26

        Are you opening it like this:

                Env.OpenFlags envFlags =
                  Env.OpenFlags.Create |
                  Env.OpenFlags.InitLock |
                  Env.OpenFlags.InitLog |
                  Env.OpenFlags.InitMPool |
                  Env.OpenFlags.InitTxn |
                  Env.OpenFlags.Recover;
                env.Open(homeDir, envFlags, 0);

        Since that is how one of my two demos does it.

        Karl

         
    • Adair Vargas

      Adair Vargas - 2007-09-26

      Yes, thats exactly what we do, but if we put the create env flag in each of the objects, got the error

       
    • Adair Vargas

      Adair Vargas - 2007-09-26

      I chequed the code, and there is no problem (only the one produced by my tests, by stopping the aplication with the stop button of the IDE). I added code to prevent any acces problem, so i think thats good. I only asking because i didn't wonder this. Actually, this happened when we tried to test times to add, remove and search records in a database.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.