-
Notifications
You must be signed in to change notification settings - Fork 387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mount disconnects after reading 1 million files #1136
Comments
@xiagao Please check |
I didn't reproduce this issue on my env. Guest: Steps:
for i in {1..3}; do mkdir F$i; done
for j in F2 F3; do for i in {1..307200}; do dd if=/dev/urandom of=./$j/file-$j-$i.txt bs=1k count=1; done; done
|
I'm glad it's not just me. Thanks. Is there a different project I should be reporting this too? I thought it was most likely yours but I wasn't sure. |
Thanks reporting. |
Cool, thanks. |
I just started hitting this bug. Interestingly I was not encountering it when I was on Ubuntu 22.04.4 if I used the virtio-win-guest-tools 0.1.225-2 But any version newer and I would hit the bug (or a similar one), so I just stayed on that version. Qemu came bundled with virtiofsd so I am unsure which version it was using. Old install that worked: After upgrading to Ubuntu 24.04.1 earlier this week I had to install virtiofsd separately as Qemu no longer bundled it and I started hitting this bug. I have tried every virtio-win-guest-tools between 0.1.225-2 and 0.1.262-2 (latest as of posting). I have also tried manually upgrading virtiofsd from 1.10.0 (from Ubuntu repo) to 1.11.1 (latest as of posting). I still hit the bug. virtiofsd is not crashing, it is the windows client as it is fixed by restarting the windows service. I set a powershell script to check the mount every minute and restart the service. I noticed every ~2 hours it would crash as my backup software was scanning the share, likely hitting the 1 million file mark as I have ~1.1 million files on that drive. Tech details Guest |
I am wondering if anyone experiences this bug with Linux guests as well |
@YanVugenfirer I just fired up an Ubuntu 22.04 VM to test that. Works perfectly fine. I used an identical virtiofs config to my windows VM (copied the XML), same host. I can run the find command over and over again with zero issues.
|
@LRomandine Can you please try running virtiofsd with --log-level debug ? And a separate run with --log-level debug and --inode-file-handles=mandatory while running virtiofsd as root |
One clarificationKVM + libvirt + QEMU seems to launch virtiofsd as root normally. This
First TestI ran the following command as the same user my VMs run as
I adjsuted my QEMU XML to the following
This test crashed as expected. log file Second TestI ran the following command as
This test did not crash after reading the 1.2mil files, so I had it read another 1.2. Zero issues. log file Third TestSince QEMU XML does not have a way to pass arbitrary flags to virtiofsd (only specific supported ones) I created a small shell script
Then set my QEMU XML to use the script (only changed the binary path, same VM as the XML I attached above)
This has the intended effect of starting virtiofsd with the
This test also did not crash after reading 1.2mil files, so I ran it again and it stayed up, just like test 2. I have switched my VM from using a different software (Dokany) to using virtiofs again. I'm going to let it run and see if virtiofs crashes at all with Update: 7 hours later and virtiofsd is stable, no crashes yet (it was crashing every 1.5-2.5 hours). |
https://issues.redhat.com/browse/RHEL-56957 - Additional discussions |
From what can be deduced from the log, you are hitting the limit of open files in linux, if running as root is not a problem the best solution is to use If running as root it's not possible: I'm not familiar with windows, but if you can configure the file metadata cache to be smaller (I have no idea if that is possible), the guest will release entries before reaching the limit |
Perhaps as a "fix" the documentation for the windows guest drivers can be updated with the 1 million files caveat and include instructions for how to add I think it would be best to get the parameter included in the XML definition and then update the libvirt and guest drivers documentation. |
Thanks so much for debugging this! I wanted to confirm what you said. "--inode-file-handles=mandatory" cannot be used if the virtiofsd process is running as root, correct? When I tried your suggestion using the virtiofsd.custom (and I did |
@dakusan I am betting your permission denied is due to AppArmor, I had a heck of a time figuring it out when I was running test 2 above. Edit:
And modified the script with the new executable name. Now AppArmor doesn't complain and it works as intended. If anyone knows AppArmor profiles and can suggest an edit, I tried the following in file
|
To |
Can confirm adding the line to
|
It's working perfectly now with 1M+ files, thanks so much! Should I maybe report to the virsh/virtual manager people a suggestion to add this as an option? |
They are aware that there are many virtiofsd options that libvirtd does not support, IIRC they have plan to add a general xml field (like extra options or something like that) so any command can be added, IMO that is the best approach |
Describe the bug
I have a linux host with an ext4 file system and a Windows 10 guest running in qemu through virt-manager. I was trying to back up the drive with backblaze but the drive kept disconnecting while scanning the file system. After running numerous tests I found out that the file system always disconnects after reading directories with a combined count of over 1 million files. By disconnect, I mean that the drive shows as empty and sometimes says "cannot access" in Windows.
To Reproduce
As an example, lets say I have the following directories, each with 300k files in their subdirectories:
F1/1
F1/2
F1/3
F1/4
F2
F3
If I run:
dir /s /b F1
It drops while scanning through F1/4 (So I reboot the VM and try the next test)
If I run:
dir /s /b F2; dir /s /b F1
It drops while scanning through F1/3.
If I run:
dir /s /b F2; dir /s /b F3; dir /s /b F1
It drops while scanning through F1/2.
Expected behavior
Drive should not drop/disconnect.
Host:
VM:
Additional context
In libvirtd.conf I added the following 2 lines:
log_filters="1:qemu 1:libvirt 4:object 4:json 4:event 1:util 1:virtiofs"
log_outputs="1:file:/var/log/libvirt/file.log"
With these I still did not see anything relevant in:
I also looked at the WinFsp logs in the Windows Event Viewer and saw nothing relevant there. Not sure where else to try and look.
The text was updated successfully, but these errors were encountered: