#1172 PasswordSafe prevents computer from going to sleep when database is on a share

Ami Castonguay

Once passwword safe has opened the safe file and has been minimized to the tray bar, a Windows 7 computer will never go to sleep after the configured duration in the power settings.

To reproduce:

  • Open password safe / open safe file
  • Select an entry and use shortcut Ctrl-L to load a web page followed by Ctrl-T to autotype password (PasswordSafe will be minimized at this point)
  • Wait the system delay for sleep (wait for delay configured in power settings)
  • Computer will not go to sleep

To confirm that PasswordSafe is causing the problem, you can list requests that are preventing the computer from going to sleep:

  • Run cmd.exe as Administrator
  • issue command powercfg -requests (Windows >= 7 only I believe)
  • The safe file is listed as preventing the computer from going to sleep

I believe that once the safe has been locked, there is no reason that the computer should be prevented from going to sleep. This can leed to quick battery depletion on a laptop computer.

Other information: my safe file resides on a NAS accessed through a Windows share. I currently don't know if this is a factor for this issue.


  • Rony Shapiro
    Rony Shapiro

    Odd. I can't find anything in the code that explains this behavior.
    Could you create a dummy password database file on your local machine (not on a share) and confirm that the problem exists with that file open by PasswordSafe?
    At least this will help narrow the scope.

  • Ami Castonguay
    Ami Castonguay

    I do not experience the problem when it is a local password database, so this issue only occurs when the password database is accessed through a Windows Share.

    It seems the default behavior for Windows is to prevent the computer from going to Sleep when there are network shares opened. A workaround may be possible but I have not figured out how. There is this registry entry "Allow sleep with remote opens" but the default is already 1:


    The only more permanent solution would be for PasswordSafe to close the file handle to the safe when safe is locked, and reopen the file when it is needed again.

  • Rony Shapiro
    Rony Shapiro

    • summary: PasswordSafe prevents computer from going to sleep --> PasswordSafe prevents computer from going to sleep when database is on a share