Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QStorageInfo::mountedVolumes() hanging forever on Linux

QStorageInfo::mountedVolumes() hanging forever on Linux

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 955 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ADGB
    wrote on last edited by
    #1

    Hello.

    Looking at this very simple program:

    #include <QCoreApplication>
    #include <QStorageInfo>
    #include <iostream>
    
    int main(int argc, char *argv[])
    {
        Q_UNUSED(argc)
        Q_UNUSED(argv)
    
        std::cout << "Before mounted volumes" << std::endl;
    
        auto volumes = QStorageInfo::mountedVolumes();
    
        std::cout << "After mounted volume" << std::endl;
        
        return 0;
    }
    

    For some unknown reason, the QStorageInfo::mountedVolumes() method freezes and is hanging forever. I let it run for several minutes, but the function did not return anything.

    Qt version: 5.12.0
    uname -a: Linux RD1 4.4.0-142-generic #168-Ubuntu SMP Wed Jan 16 21:00:45 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

    Do you have any idea why it would hang like this? Anything I can do to resolve it or investigate the issue?

    Thanks.

    J.HilkJ jsulmJ 2 Replies Last reply
    0
    • A ADGB

      Hello.

      Looking at this very simple program:

      #include <QCoreApplication>
      #include <QStorageInfo>
      #include <iostream>
      
      int main(int argc, char *argv[])
      {
          Q_UNUSED(argc)
          Q_UNUSED(argv)
      
          std::cout << "Before mounted volumes" << std::endl;
      
          auto volumes = QStorageInfo::mountedVolumes();
      
          std::cout << "After mounted volume" << std::endl;
          
          return 0;
      }
      

      For some unknown reason, the QStorageInfo::mountedVolumes() method freezes and is hanging forever. I let it run for several minutes, but the function did not return anything.

      Qt version: 5.12.0
      uname -a: Linux RD1 4.4.0-142-generic #168-Ubuntu SMP Wed Jan 16 21:00:45 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

      Do you have any idea why it would hang like this? Anything I can do to resolve it or investigate the issue?

      Thanks.

      J.HilkJ Online
      J.HilkJ Online
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      Hi @ADGB
      could you try with 5.12.1 ?
      5.12.0 has a lot of bugs, some of them fundamental.

      .1 has over 300 bug fixes, maybe this is one of them.


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      0
      • A ADGB

        Hello.

        Looking at this very simple program:

        #include <QCoreApplication>
        #include <QStorageInfo>
        #include <iostream>
        
        int main(int argc, char *argv[])
        {
            Q_UNUSED(argc)
            Q_UNUSED(argv)
        
            std::cout << "Before mounted volumes" << std::endl;
        
            auto volumes = QStorageInfo::mountedVolumes();
        
            std::cout << "After mounted volume" << std::endl;
            
            return 0;
        }
        

        For some unknown reason, the QStorageInfo::mountedVolumes() method freezes and is hanging forever. I let it run for several minutes, but the function did not return anything.

        Qt version: 5.12.0
        uname -a: Linux RD1 4.4.0-142-generic #168-Ubuntu SMP Wed Jan 16 21:00:45 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

        Do you have any idea why it would hang like this? Anything I can do to resolve it or investigate the issue?

        Thanks.

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @ADGB Run it with strace:

        strace ./your_app
        

        and put the output here - maybe we can see where exactly it is hanging.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        2
        • A Offline
          A Offline
          ADGB
          wrote on last edited by
          #4

          Thanks @J-Hilk and @jsulm for the quick responses.

          The issue came from a device which was not properly mounted.

          strace was hanging here:

          [...]
          getcwd("/home/myself/build-mountedvolumes-Desktop-Debug", 4096) = 50
          lstat("/home/myself/build-mountedvolumes-Desktop-Debug/systemd-1", 0x7ffcc45c5d70) = -1 ENOENT (No such file or directory)
          open("/dev/disk/by-label", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
          read(3, "nproto=5,maxproto=5,direct\n93 20"..., 1024) = 1024
          lstat("/home", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
          lstat("/home/user", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
          lstat("/home/user/SSD211", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
          open("/proc/self/mountinfo", O_RDONLY|O_CLOEXEC) = 4
          fstat(4, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
          read(4, "18 24 0:17 / /sys rw,nosuid,node"..., 1024) = 1024
          read(4, "s-agent,name=systemd\n30 18 0:24 "..., 1024) = 1024
          read(4, "oexec,relatime shared:21 - cgrou"..., 1024) = 1024
          read(4, "nproto=5,maxproto=5,direct\n93 20"..., 1024) = 1024
          read(4, "user/SSD212 rw,relatime share"..., 1024) = 536
          read(4, "", 1024)                       = 0
          close(4)                                = 0
          statfs("/home/user/SSD211", ^C
          

          This happened because [Automount] and [Mount] directives in our systemd services failed but left the device in a unstable state. Or maybe that the service was just hanging and no releasing the device while trying to mount it, preventing QStorageInfo::mountedVolumes() to access the device.

          Thanks again for your help!

          1 Reply Last reply
          3

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved