Nominate our 2022 Qt Champions!

QStorageInfo::mountedVolumes can take 20 seconds or more to return when there are disconnected network drives on Windows 7

  • Has anyone seen this and do you have any suggestions?
    I map a network drive to another PC while that PC is on. Everything's great; QStorageInfo::mountedVolumes sees it and I can access it (e.g. in QFileSystemModel).

    Then I unplug that PC's network cable, thereby making the mapped drive no longer valid.

    I do calls once per second to QStorageInfo::mountedVolumes and it returns normally (80 - 100ms) for about 28 secs then will take 20 seconds or more to return. Then 28 secs normal, then 20 - 21 secs to return. And so on.

    I hadn't bothered to move that to its own thread (I will now) so it was hanging the GUI.

    Guessing it's Windows itself, since many other Windows native ops seem to take a long time during network weirdness.

    Also, removing the (bad) mapped drive in Windows solves the problem.

  • Lifetime Qt Champion

    well, I sometimes map drives into my virtual linux. And
    if I close the virtual machine, the explorer hangs for quite some time until
    it realize its gone. So to some degree, its normal.
    And and I do see something like you describe that sometimes
    it can time out really fast and say "error" , other times
    it completely hang for around half a minute. (not timed it)

  • More data implicating Windows: Starting Windows this morning took an extra 3 or more minutes because I had a dead mapped drive. GUI was blocked the whole time.

Log in to reply