Menu

#1583 Fail to save .KDBX file when the drive is slow. Leads to crash.

KeePass_2.x
closed
nobody
None
5
2017-10-29
2016-10-31
No

I found a bug that affect me with some frequency and lost a couple of passwords because of that, in addition to the risk to have the full database corrupted.

I am running KeePass 2.34 for Windows with an Auto Save Database trigger to save any change.

If I edit, change, add password on keepass while some heavy task is ongoing in the hard disk it fail to access a .tmp file and keep showing the same error message with an OK button. Pressing that OK button... it close and reopen the same screen with the same error message and the same OK button.

The task that make the HD slow is usually a file shadow copy as part of my automated backup system.

There is no way to close the error message (because it reopen) and keepass does not allow to do anything else. Even waiting for many minutes, after the shadow copy ended, keepass still is showing such error message, and reopening it after the OK button is pressed.

The only way to close keepass is by killing its process at windows task manager.

Attached are some imagens showing the problem and additional information.

3 Attachments

Discussion

  • Paul

    Paul - 2016-10-31

    I would turn off "file transactions" to see if that fixes the issue. Tools > Options > Advanced, File Input/Output Connections.
    Ultimately I'd be looking for a faster disk sub-system. That sort of performance bottleneck is not acceptable in a production system IMO.

    cheers, Paul

     
  • Dominik Reichl

    Dominik Reichl - 2016-10-31
    • status: open --> closed
     
  • Dominik Reichl

    Dominik Reichl - 2016-10-31

    The error message in the screenshot indicates that a different process has opened the .tmp file and Windows thus prevents KeePass from accessing the file. Most likely this has to do with your backup system. You can find out which application has opened the file by using a tool like Process Explorer (via 'Find' -> 'Find Handle or DLL').

    I don't see any KeePass bug. There's nothing KeePass can do when Windows blocks access to the file.

    Best regards,
    Dominik

     
  • Sukhoi Berkut

    Sukhoi Berkut - 2016-10-31

    The error message in the screenshot indicates that a different process has
    opened the .tmp file and Windows thus prevents KeePass from accessing the file.

    Is likely the shadow copy is freezing the HD drive access for a short time, but the bug I am talking about is not that one.

    If keepass fail in access the .tmp file it pops-up the error message, but then - the bug - seems it no longer check if the .tmp file became available or not after the OK button is pressed, but just keep repeating the same error message.

    I am expecting that, if the .tmp file becomes available, then by pressing the OK button keepass will finish the processing as expected. Yesterday I waited for 20 minutes and by pressing OK button keepass still was just repeating the same error message.

     

    Last edit: Sukhoi Berkut 2016-10-31
  • Dominik Reichl

    Dominik Reichl - 2016-10-31

    When trying to save, KeePass tries to write the file; it doesn't remember any information about the state of the .tmp file. If you get the error message, then at this time the access is blocked. Especially, if it still doesn't work after 20 minutes, then the file is still locked by a different application. Like I wrote before, you can use Process Explorer to investigate.

    Best regards,
    Dominik

     
  • Paul

    Paul - 2016-11-02

    You should not have lost any entries because the temp file is the new database. I assume it has been backed up because of the locking issue, so restoring and renaming it should return your data.

    cheers, Paul

     
  • Sukhoi Berkut

    Sukhoi Berkut - 2016-11-03

    I can quote another situation when I faced the same problem.
    The .KDBX database as in a memory stick with Keepass running.
    Then the memory stick was removed and keepass showed the same error window, then the memory stick was pluged-in again, but keepass kept showing the same error window, over and over. Had to kill keepass process with the windows task manager. :/

     

    Last edit: Sukhoi Berkut 2016-11-03
  • Paul

    Paul - 2016-11-03

    I can't replicate the issue in KeePass 2.34 on W8.1.
    I get this error and KeePass closes cleanly.
    Do you have any plug-ins? If so remove them temporarily.

    cheers, Paul

     
  • Dominik Reichl

    Dominik Reichl - 2016-11-03

    I cannot reproduce this either. I did the following (with KeePass 2.34 on Windows 10):

    1. Open a database file from a USB stick.
    2. Remove USB stick and try to save. Result: the error message that Paul posted, as expected.
    3. Plug in the USB stick again and try to save. Result: the database file is saved fine.

    Again, my suggestion would be to try finding out which application is blocking KeePass from writing the database file on your PC. If you don't like Process Explorer, you could also use the Resource Monitor built-in to Windows (on the 'CPU' tab, search in the 'Associated Handles' for the database file name).

    Typically, such file access problems are caused by broken security software (especially anti-virus programs), backup or indexing software. Removing any KeePass plugins for testing is also a good idea.

    Best regards,
    Dominik

     
  • Paul

    Paul - 2016-11-03

    Wow, you have a lot of plug-ins!

    cheers, Paul

     
  • pio

    pio - 2017-10-22

    Hi,
    I also experience this issue.
    In my case the lock of .tmp file is probably due to gdrive sync client.
    I've tried to follow Paul's suggestion: https://sourceforge.net/p/keepass/bugs/1583/#1b14
    and seems to work.
    Are there any negative effects of turning off "file transactions" ?
    Thanks in advance,
    Pio

     
  • Paul

    Paul - 2017-10-23

    File transactions are to prevent complete loss of the database if there is a disk issue. Given the nature of a KeePass database I would want transactions on.

    Instead of saving directly to the gdrive sync location, save in a local folder, then sync with the gdrive file. This gives you a secure local file and allows gdrive to sync at it's leisure.
    https://keepass.info/help/kb/trigger_examples.html#dbsync

    cheers, Paul

     
  • pio

    pio - 2017-10-28

    Hi,
    I did the procedure you suggest ( https://sourceforge.net/p/keepass/bugs/1583/#f636 )
    But when I save a change, I receive a Windows pop-up that says I cannot access to the synced folder (where the synced copy of the database resides).
    Can you help me ?
    This happens also if I run keepass as administrator.

     
  • pio

    pio - 2017-10-28

    Sorry, I was making a mistake, I forgot the file name in the path.
    Now it works.
    However, I had to add a condition on the database path, because I have more than one database to synchronize; so I had to create more triggers (each of them conditioned on one database path).
    Thank you very much for your help.

     
  • Paul

    Paul - 2017-10-29

    You can use one trigger if you use a place holder to name the database.
    e.g. C:\GDsync{DB_NAME}

    cheers, Paul

     

Log in to post a comment.