NFS connection freezing every few seconds
I have 2 Arch boxes on my network. One is my personal rig, the other is my NAS among other things. I have set an NFS server on the NAS that I access with my PC.
Whenever I'm playing a video file, or sometimes just even browsing files on the server, the connection seems to freeze for a few seconds, subsequently freezing every program that is reading files off of the server, (dolphin, mpv, terminals, etc). This repeats every few seconds, to the point that I'm unable to stream anything from the server.
I'm not 100% sure but I think the problem is much more pronounced when I'm doing things that demand high bandwidth (streaming, copying, etc).
The connection between the 2 machines is gbit ethernet.
I have not been able to replicate the behaviour on my laptop (also Arch), over 5G wifi.
An sshfs connection is perfectly stable, so it's probably not a network issue.
systemctl/journalctl/dmesg provide no hints on either the server or the PC.
The NFS configs
/etc/fstab - Server
# /dev/md127
UUID=9001b3fd-9fe6-40d2-bd21-7238ff55c061 /mnt/Achne ext4 rw,auto 0 2
/mnt/Achne /srv/nfs none bind 0 0
/etc/exports - Server
/srv/nfs *(rw,sync,no_subtree_check)
/etc/systemd/system/mnt-Achne.mnt - PC
[Unit]
Description=Mount Share at boot
[Mount]
What=192.168.1.3:/srv/nfs
Where=/mnt/Achne
Options=
Type=nfs
[Install]
WantedBy=multi-user.target
Can anybody help me debug this thing? It's been bugging me for weeks.
I used to run OMV5 on the server, until a power failure ruined the boot drive, so I thought I'd switch to Arch since I'm more familiar with it...
IIRC I didn't really change mnt-Achne.mnt, beyond changing the What. So I didn't have any fancy options enabled with OMV. Maybe OMV sets some server-side options that I don't know about.
About this post
- Posted
- Archived
- Score
- 13 · 89% up
- Kind
- Text
- ID
- pc11ik
20 comments
I have a bug/ticket open on a possibly similar issue - https://bugs.archlinux.org/task/71775 . Been getting some help from linux kernel devs to look at it some as well, but so far no solution. If you feel it's similar to my issue, please chime in and "vote" it up so it can get more attention.
You can try downgrading to a 5.12.x kernel to see if that resolves the issue as well (it seems to be a 5.13 kernel issue for me). To do that you would run the following:
Ok, seems like downgrading the server has indeed fixed the issue, though I'll try it some more in half an hour, sometimes it doesn't show immediately after a reboot.
But I think this might be the longest already so far, so it looks like the kernel is indeed the culprit.
That definitely sounds like my issue, I'll try the downgrade.
Yep. Still stable. Kernel is the culprit.
For those interested, there is 2 patches for the 5.13 kernel that seem to resolve the issue for me. They are linked from the archlinux bugtracker link above. I have also shared a kernel package there that includes both of the fixes which I am testing now.
why bind mount and not exporting /mnt/Achne directly
Good question. Don't remember. Let me try the direct method.
reading the wiki I was somehow tempted to think that only dirs under /srv are exportable, which was of course not true
Nope. It fixed it at first, but after 2-3 minutes, same thing.
Same things happens when I reboot btw.
Yeah, I had some problems with NFS (on an OMV server, not Arch, but I don't think that matter much, honestly) on my LAN as well but this setup (in combination with autofs) has proven to be very reliable over the past year or so.
I don't think any of that helps me unfortunately.
ID mapping isn't an issue since I've managed it manually(by changing UIDs & GIDs).
And autofs takes care of discoverability and mounting when needed if I understand correctly, neither of which are an issue for me.
My woes begin after mounting is done.
Still, thank you for taking the time. And seeing other people's configs might actually help me.
try disabling mnt-Achne.mnt and mounting the NFS drive manually for once, to make sure it ain’t a systemd bug?
Is it possible to run a tcpdump/wireshark capture on the NAS (ssh+tmux) or on the PC and see if there are any nfs-related packets being transferred at all during the freeze?
Wireshark shows a
[TCP Retransmission]from the PC at the time of failure, and an[ACK]from the server, nothing more until it unfreezes.I don't know what to do with that information.
Can’t guarantee to be able to decipher, but does it help if you post a rough screenshot of the capture?
take the risk and *(...async...)unlikely to work though, since streaming reads a lot yet hardly writes anything, but might worth a try
kernel culprit, dismiss
Maybe try to optimize TCP Stack here there is a guide to :
https://wiki.archlinux.org/title/Sysctl#Improving_performance