<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QStorageInfo::mountedVolumes() hanging forever on Linux]]></title><description><![CDATA[<p dir="auto">Hello.</p>
<p dir="auto">Looking at this very simple program:</p>
<pre><code>#include &lt;QCoreApplication&gt;
#include &lt;QStorageInfo&gt;
#include &lt;iostream&gt;

int main(int argc, char *argv[])
{
    Q_UNUSED(argc)
    Q_UNUSED(argv)

    std::cout &lt;&lt; "Before mounted volumes" &lt;&lt; std::endl;

    auto volumes = QStorageInfo::mountedVolumes();

    std::cout &lt;&lt; "After mounted volume" &lt;&lt; std::endl;
    
    return 0;
}
</code></pre>
<p dir="auto">For some unknown reason, the <a href="https://doc.qt.io/qt-5/qstorageinfo.html#mountedVolumes" target="_blank" rel="noopener noreferrer nofollow ugc"><code>QStorageInfo::mountedVolumes()</code></a> method freezes and is hanging forever. I let it run for several minutes, but the function did not return anything.</p>
<p dir="auto"><strong>Qt version:</strong> 5.12.0<br />
<strong>uname -a:</strong> 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</p>
<p dir="auto">Do you have any idea why it would hang like this? Anything I can do to resolve it or investigate the issue?</p>
<p dir="auto">Thanks.</p>
]]></description><link>https://forum.qt.io/topic/99685/qstorageinfo-mountedvolumes-hanging-forever-on-linux</link><generator>RSS for Node</generator><lastBuildDate>Tue, 07 Apr 2026 14:44:41 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/99685.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 14 Feb 2019 09:23:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QStorageInfo::mountedVolumes() hanging forever on Linux on Thu, 14 Feb 2019 10:30:00 GMT]]></title><description><![CDATA[<p dir="auto">Thanks @J-Hilk and <a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> for the quick responses.</p>
<p dir="auto">The issue came from a device which was not properly mounted.</p>
<p dir="auto"><code>strace</code> was hanging here:</p>
<pre><code>[...]
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
</code></pre>
<p dir="auto">This happened because <code>[Automount]</code> and <code>[Mount]</code> directives in our <code>systemd</code> 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 <code>QStorageInfo::mountedVolumes()</code> to access the device.</p>
<p dir="auto">Thanks again for your help!</p>
]]></description><link>https://forum.qt.io/post/511477</link><guid isPermaLink="true">https://forum.qt.io/post/511477</guid><dc:creator><![CDATA[ADGB]]></dc:creator><pubDate>Thu, 14 Feb 2019 10:30:00 GMT</pubDate></item><item><title><![CDATA[Reply to QStorageInfo::mountedVolumes() hanging forever on Linux on Thu, 14 Feb 2019 09:54:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/adgb">@<bdi>ADGB</bdi></a> Run it with strace:</p>
<pre><code>strace ./your_app
</code></pre>
<p dir="auto">and put the output here - maybe we can see where exactly it is hanging.</p>
]]></description><link>https://forum.qt.io/post/511473</link><guid isPermaLink="true">https://forum.qt.io/post/511473</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Thu, 14 Feb 2019 09:54:30 GMT</pubDate></item><item><title><![CDATA[Reply to QStorageInfo::mountedVolumes() hanging forever on Linux on Thu, 14 Feb 2019 09:51:07 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/user/adgb">@<bdi>ADGB</bdi></a><br />
could you try with 5.12.1 ?<br />
5.12.0 has a lot of bugs, some of them fundamental.</p>
<p dir="auto">.1 has over 300 bug fixes, maybe this is one of them.</p>
]]></description><link>https://forum.qt.io/post/511471</link><guid isPermaLink="true">https://forum.qt.io/post/511471</guid><dc:creator><![CDATA[J.Hilk]]></dc:creator><pubDate>Thu, 14 Feb 2019 09:51:07 GMT</pubDate></item></channel></rss>