Device or resource busy

General support for problems installing or using Deluge
siddhartha
Member
Member
Posts: 13
Joined: Wed Dec 14, 2016 3:02 am

Re: Device or resource busy

Post by siddhartha »

********************
*** SOLUTION ***
********************

After days of searching, I think I've found the solution: rollback the Linux kernel.

I have a feeling that the Spectre/Meltdown fix introduced in a recent patch slows down the box enough to cause large file operations consuming a lot of CPU time (like Deluge) to throw errors.

This solution means that your system will be vulnerable to Spectre/Meltdown.

For my setup, the only user software run on the box is deluged, flexget, and openvpn. I'm more concerned about functionality over security. If you install and run different software on your system, this might not be the best solution for you, but as far as I can tell, it is the only solution at this point. Luckily, it's very simple to bounce back and forth between kernels as new ones are released.

I'm running Debian (9.4 Stretch), so this is what I did:

Code: Select all

sudo apt-get install linux-image-4.9.0-3-amd64
This will download and install the older kernel just prior to the Spectre/Meltdown fix.

At this point, you can simply run:

Code: Select all

sudo update-grub
Reboot and select this previous kernel version from the grub menu on startup. This will at least allow you to test if this fix works for you. If it does, then upon reboot your grub configuration will likely default to the latest kernel again. To fix this, you can set grub to default to the last selected kernel on startup. You need to run:

Code: Select all

sudo vi /etc/default/grub
Update the following line to read:

Code: Select all

GRUB_DEFAULT=saved
Add the following line:

Code: Select all

GRUB_SAVEDEFAULT=true
Then run:

Code: Select all

sudo update-grub
Now reboot and select the older 4.9.0-3 kernel in grub. When you reboot, grub will default to that selection from now on.

You can always confirm your kernel by running:

Code: Select all

uname -a
Azelphur
Member
Member
Posts: 10
Joined: Sun May 17, 2015 1:47 am

Re: Device or resource busy

Post by Azelphur »

Wow, that's really interesting - you went really deep into this! I ended up rolling back to smb but when I have some time I'll confirm this - do we have a bug report open elsewhere about this? sounds like a kernel regression?
siddhartha
Member
Member
Posts: 13
Joined: Wed Dec 14, 2016 3:02 am

Re: Device or resource busy

Post by siddhartha »

I have not submitted a bug report yet. I just now concluded that the problem is unique to Deluge.

I'm running Debian. I wanted to first eliminate the kernel as the source, so I installed the latest version from sid, which was linux-image-4.15.0-1-amd64.

My test torrent was an 11 GB copy of SWTLJ, so it had thousands of seeds. Using deluge 1.3.15, the download speed got up to around 4 MiB/s after less than 20 seconds and then immediately failed.

Without restarting and using the same 4.15.0-1 kernel, I installed qBittorrent 3.3.7 (qbittorrent-nox) and setup the daemon to use the same user as the Deluge daemon. I also pointed qBittorrent to download to the same NFS mount as Deluge. The settings were as close as possible for network, bandwidth, and queue, including the number of global and per-torrent connections. With qBittorrent, download speeds got up to just over 8 MiB/s, averaging at 6 MiB/s and the torrent downloaded without issue.

Both deluged and qbittorrent-nox had roughly the same CPU usage at above 65%.

Since I was using the same VM with the same kernel with the same user on the same NFS mount and qBittorrent also uses libtorrent, I think it's safe to conclude that the error is unique to Deluge. What's frustrating is that downgrading the kernel to 4.9.0-3 solves the problem.
Azelphur
Member
Member
Posts: 10
Joined: Sun May 17, 2015 1:47 am

Re: Device or resource busy

Post by Azelphur »

Your symptoms certainly seem to mirror mine. Hopefully a deluge dev can come by and take a look.
siddhartha
Member
Member
Posts: 13
Joined: Wed Dec 14, 2016 3:02 am

Re: Device or resource busy

Post by siddhartha »

I opened a bug report here. Please post any comments or research to that ticket.
Azelphur
Member
Member
Posts: 10
Joined: Sun May 17, 2015 1:47 am

Re: Device or resource busy

Post by Azelphur »

I'm running ArchLinux and rolled my kernel back to 4.8.9-1. I also switched back to NFS. Been up and running for 4 hours now, so I can tentatively say that this is some issue involving newer kernels and deluge.

So, to be clear
deluge + newer kernel + nfs = device or resource busy
deluge + 4.8.9-1 + nfs = works fine
deluge + newer kernel + smb = works fine.

Hope this helps.

I would add this information on the bug report, but it requires email validation and is not sending me the validation email. I guess it's broke.
Azelphur
Member
Member
Posts: 10
Joined: Sun May 17, 2015 1:47 am

Re: Device or resource busy

Post by Azelphur »

Was talking about this in ##Linux on freenode:
(20:29:27) o0ze: Azelphur, i can confirm is not a deluge issue. if libtorrent+new kernel is involved these issues occur. for example qbittorent-nox has the same issues.
(20:31:52) o0ze: Azelphur, i pin pointed it to 2 packages if they were not upgraded you could use a new kernel. let me look it up.
(20:37:25) o0ze: Azelphur, erm 3
(20:37:29) o0ze: [2018-02-20 19:23] [PACMAN] Running 'pacman -U /var/cache/pacman/pkg/boost-libs-1.65.1-2-x86_64.pkg.tar.xz'
(20:37:29) o0ze: [2018-02-20 19:24] [PACMAN] Running 'pacman -U /var/cache/pacman/pkg/boost-1.65.1-2-x86_64.pkg.tar.xz'
(20:37:43) o0ze: [2018-02-20 19:22] [PACMAN] Running 'pacman -U /var/cache/pacman/pkg/libtorrent-rasterbar-1:1.1.5-1-x86_64.pkg.tar.xz'
I guess I'll give this a test now - this bug is getting weird.
siddhartha
Member
Member
Posts: 13
Joined: Wed Dec 14, 2016 3:02 am

Re: Device or resource busy

Post by siddhartha »

Interesting. I have not been able to reproduce the error with qbittorent-nox all else being equal.
siddhartha
Member
Member
Posts: 13
Joined: Wed Dec 14, 2016 3:02 am

Re: Device or resource busy

Post by siddhartha »

Okay... I can confirm that qBittorrent on the new stable kernel linux-image-4.9.0-6-amd64 works perfectly fine. Deluge does not.

I can also confirm that Deluge 2.0b1 exhibits the same behaviour.

I compiled libtorrent 1.1.6 from source and the problem still persists. I did a compile of the latest libtorrent (1.2), but Deluge uses some deprecated functions that have been removed (settings_pack is now preferred over session_settings).
Azelphur
Member
Member
Posts: 10
Joined: Sun May 17, 2015 1:47 am

Re: Device or resource busy

Post by Azelphur »

Just fyi, I have been running on kernel 4.15.10-1-ARCH with the packages I mentioned above for the past few days. No issues.
Post Reply