qbittorrent-nox-static icon indicating copy to clipboard operation
qbittorrent-nox-static copied to clipboard

After updating from 4.6.3 (2.0.9) to 4.6.3 (2.0.10) or 4.6.4 (2.0.10), all completed tasks disappeared.

Open ivan-yu opened this issue 1 year ago • 47 comments

There are a lot of errors opening categories.json and fastresume files when using Libtorrent 2.0.10

Below nox has errors https://github.com/userdocs/qbittorrent-nox-static/releases/download/release-4.6.3_v2.0.10/aarch64-qbittorrent-nox

Below nox has no error https://github.com/userdocs/qbittorrent-nox-static/releases/download/release-4.6.3_v2.0.9/aarch64-qbittorrent-nox

(N) 2024-04-28T16:29:05 - qBittorrent v4.6.4 started
(N) 2024-04-28T16:29:05 - Using config directory: /usr/local/AppCentral/qbittorrent-native/home/.config/qBittorrent
(N) 2024-04-28T16:29:05 - qBittorrent termination initiated
(N) 2024-04-28T16:29:05 - qBittorrent is now ready to exit
(N) 2024-04-28T16:29:05 - qBittorrent v4.6.4 started
(N) 2024-04-28T16:29:05 - Using config directory: /usr/local/AppCentral/qbittorrent-native/home/.config/qBittorrent
(N) 2024-04-28T16:29:05 - Trying to listen on the following list of IP addresses: "0.0.0.0:49162,[::]:49162"
(I) 2024-04-28T16:29:05 - Peer ID: "-qB4640-"
(I) 2024-04-28T16:29:05 - HTTP User-Agent: "qBittorrent/4.6.4"
(I) 2024-04-28T16:29:05 - Distributed Hash Table (DHT) support: ON
(I) 2024-04-28T16:29:05 - Local Peer Discovery support: ON
(I) 2024-04-28T16:29:05 - Peer Exchange (PeX) support: ON
(I) 2024-04-28T16:29:05 - Anonymous mode: ON
(I) 2024-04-28T16:29:05 - Encryption support: FORCED
(W) 2024-04-28T16:29:05 - Failed to load Categories. File size exceeds limit. File: "/usr/local/AppCentral/qbittorrent-native/home/.
config/qBittorrent/categories.json". File size: 548320867016. Size limit: 1048576
(I) 2024-04-28T16:29:05 - Successfully listening on IP. IP: "127.0.0.1". Port: "TCP/49162"
(I) 2024-04-28T16:29:05 - Successfully listening on IP. IP: "127.0.0.1". Port: "UTP/49162"
(I) 2024-04-28T16:29:05 - Successfully listening on IP. IP: "192.168.1.4". Port: "TCP/49162"
(I) 2024-04-28T16:29:05 - Successfully listening on IP. IP: "192.168.1.4". Port: "UTP/49162"
(C) 2024-04-28T16:29:05 - Failed to resume torrent. Torrent: "14ee1e4c0bd612f786393376e94ff872b6e87cfa". Reason: "File size exceeds
limit. File: "/usr/local/AppCentral/qbittorrent-native/home/.local/share/qBittorrent/BT_backup/14ee1e4c0bd612f786393376e94ff872b6e87
cfa.fastresume". File size: 548318599328. Size limit: 104857600"
(C) 2024-04-28T16:29:05 - Failed to resume torrent. Torrent: "2df9db306f21320a986eb695cb9f63044b618140". Reason: "File size exceeds
limit. File: "/usr/local/AppCentral/qbittorrent-native/home/.local/share/qBittorrent/BT_backup/2df9db306f21320a986eb695cb9f63044b618
140.fastresume". File size: 548318599328. Size limit: 104857600"
(C) 2024-04-28T16:29:05 - Failed to resume torrent. Torrent: "89014345d130b47c1c0a870083fdd73206b09288". Reason: "File size exceeds
limit. File: "/usr/local/AppCentral/qbittorrent-native/home/.local/share/qBittorrent/BT_backup/89014345d130b47c1c0a870083fdd73206b09
288.fastresume". File size: 548318599328. Size limit: 104857600"
(C) 2024-04-28T16:29:05 - Failed to resume torrent. Torrent: "5c1429081a586f813b32ce5dcba9d646500b7d61". Reason: "File size exceeds
limit. File: "/usr/local/AppCentral/qbittorrent-native/home/.local/share/qBittorrent/BT_backup/5c1429081a586f813b32ce5dcba9d646500b7
d61.fastresume". File size: 548318599328. Size limit: 104857600"
(C) 2024-04-28T16:29:05 - Failed to resume torrent. Torrent: "0725c0afca67e94f7bca31636a95caa691391ada". Reason: "File size exceeds
limit. File: "/usr/local/AppCentral/qbittorrent-native/home/.local/share/qBittorrent/BT_backup/0725c0afca67e94f7bca31636a95caa691391
ada.fastresume". File size: 548318599328. Size limit: 104857600"
(C) 2024-04-28T16:29:05 - Failed to resume torrent. Torrent: "195ff0aab50e90bde03cde6c608206e7c21e273e". Reason: "File size exceeds
limit. File: "/usr/local/AppCentral/qbittorrent-native/home/.local/share/qBittorrent/BT_backup/195ff0aab50e90bde03cde6c608206e7c21e2
73e.fastresume". File size: 548318599328. Size limit: 104857600"


ivan-yu avatar Apr 30 '24 04:04 ivan-yu

Please refer to below linked issue https://github.com/qbittorrent/qBittorrent/issues/20772

ivan-yu avatar Apr 30 '24 15:04 ivan-yu

So without being able to replicate the issue you will need to do some of the work to isolate the issue.

You can start by testing these builds.

https://github.com/userdocs/qbittorrent-nox-static-test/releases/tag/release-4.6.4_v2.0.10

userdocs avatar Apr 30 '24 16:04 userdocs

I already did the testing, please see below logs for clear comparison. This same bug exists in 4.6.3 v2.0.10 already, and continues to exist in 4.6.4 v2.0.10

Please see below two log files. First one (no error) is using 4.6.3_v2.0.9/aarch64-qbittorrent-nox Second one (lots of file open errors) is using 4.6.3_v2.0.10/aarch64-qbittorrent-nox Everything else are the same, i.e. my OS, qBittorrent config, fast resume files, save location, etc.

You can see all the file open function calls failed. They all say File size: 547866034680 547866034680 is obviously not the file size at all. For example, categories.json is just 4 bytes in size. -rw-r--r-- 1 root root 4 Mar 23 20:52 categories.json

(N) 2024-04-30T10:50:31 - qBittorrent v4.6.3 started
(N) 2024-04-30T10:50:31 - Using config directory: /usr/local/AppCentral/qbittorrent-native/home/.config/qBittorrent
(N) 2024-04-30T10:50:31 - Trying to listen on the following list of IP addresses: "0.0.0.0:49162,[::]:49162"
(I) 2024-04-30T10:50:31 - Peer ID: "-qB4630-"
(I) 2024-04-30T10:50:31 - HTTP User-Agent: "qBittorrent/4.6.3"
(I) 2024-04-30T10:50:31 - Distributed Hash Table (DHT) support: ON
(I) 2024-04-30T10:50:31 - Local Peer Discovery support: ON
(I) 2024-04-30T10:50:31 - Peer Exchange (PeX) support: ON
(I) 2024-04-30T10:50:31 - Anonymous mode: ON
(I) 2024-04-30T10:50:31 - Encryption support: FORCED
(I) 2024-04-30T10:50:31 - Successfully listening on IP. IP: "127.0.0.1". Port: "TCP/49162"
(I) 2024-04-30T10:50:31 - Successfully listening on IP. IP: "127.0.0.1". Port: "UTP/49162"
(I) 2024-04-30T10:50:31 - Successfully listening on IP. IP: "192.168.1.4". Port: "TCP/49162"
(I) 2024-04-30T10:50:31 - Successfully listening on IP. IP: "192.168.1.4". Port: "UTP/49162"
(N) 2024-04-30T10:50:31 - Restored torrent. Torrent: "TVBOXNOW 聲夢1+2"
(N) 2024-04-30T10:50:31 - Restored torrent. Torrent: "TVBXONOW 怪宿宿"
(N) 2024-04-30T10:50:31 - Restored torrent. Torrent: "TVBOXNOW 香港婚後事"
(N) 2024-04-30T10:50:31 - Restored torrent. Torrent: "TVBOXNOW 逆天奇案2 H265"
(N) 2024-04-30T10:58:45 - qBittorrent v4.6.3 started
(N) 2024-04-30T10:58:45 - Using config directory: /usr/local/AppCentral/qbittorrent-native/home/.config/qBittorrent
(N) 2024-04-30T10:58:45 - Trying to listen on the following list of IP addresses: "0.0.0.0:49162,[::]:49162"
(I) 2024-04-30T10:58:45 - Peer ID: "-qB4630-"
(I) 2024-04-30T10:58:45 - HTTP User-Agent: "qBittorrent/4.6.3"
(I) 2024-04-30T10:58:45 - Distributed Hash Table (DHT) support: ON
(I) 2024-04-30T10:58:45 - Local Peer Discovery support: ON
(I) 2024-04-30T10:58:45 - Peer Exchange (PeX) support: ON
(I) 2024-04-30T10:58:45 - Anonymous mode: ON
(I) 2024-04-30T10:58:45 - Encryption support: FORCED
(W) 2024-04-30T10:58:45 - Failed to load Categories. File size exceeds limit. File: "/usr/local/AppCentral/qbittorrent-native/home/.
config/qBittorrent/categories.json". File size: 547866034680. Size limit: 1048576
(I) 2024-04-30T10:58:45 - Successfully listening on IP. IP: "127.0.0.1". Port: "TCP/49162"
(I) 2024-04-30T10:58:45 - Successfully listening on IP. IP: "127.0.0.1". Port: "UTP/49162"
(I) 2024-04-30T10:58:45 - Successfully listening on IP. IP: "192.168.1.4". Port: "TCP/49162"
(I) 2024-04-30T10:58:45 - Successfully listening on IP. IP: "192.168.1.4". Port: "UTP/49162"
(C) 2024-04-30T10:58:45 - Failed to resume torrent. Torrent: "4c9bba37fa279a4b4e740fe04701034723668af0". Reason: "File size exceeds
limit. File: "/usr/local/AppCentral/qbittorrent-native/home/.local/share/qBittorrent/BT_backup/4c9bba37fa279a4b4e740fe04701034723668
af0.fastresume". File size: 547863746816. Size limit: 104857600"
(C) 2024-04-30T10:58:45 - Failed to resume torrent. Torrent: "1ba472f6c47d6b5b65a2e39cdb959d48cecd6e3d". Reason: "File size exceeds
limit. File: "/usr/local/AppCentral/qbittorrent-native/home/.local/share/qBittorrent/BT_backup/1ba472f6c47d6b5b65a2e39cdb959d48cecd6
e3d.fastresume". File size: 547863746816. Size limit: 104857600"
(C) 2024-04-30T10:58:45 - Failed to resume torrent. Torrent: "fa129e88907d10914273178cabba8afc014c316d". Reason: "File size exceeds
limit. File: "/usr/local/AppCentral/qbittorrent-native/home/.local/share/qBittorrent/BT_backup/fa129e88907d10914273178cabba8afc014c3
16d.fastresume". File size: 547863746816. Size limit: 104857600"
(C) 2024-04-30T10:58:45 - Failed to resume torrent. Torrent: "fcfd4e7a4b1b820bb8f3e8ab87cee7156ff5ccde". Reason: "File size exceeds
limit. File: "/usr/local/AppCentral/qbittorrent-native/home/.local/share/qBittorrent/BT_backup/fcfd4e7a4b1b820bb8f3e8ab87cee7156ff5c
cde.fastresume". File size: 547863746816. Size limit: 104857600"

ivan-yu avatar Apr 30 '24 16:04 ivan-yu

May I suggest you create a path the same as mine, to replicate this file open error? Maybe with focus on how File size: 547866034680 (such a large number) can be returned?

ivan-yu avatar Apr 30 '24 16:04 ivan-yu

root@IVAN-NAS:/volume1/.@plugins/AppCentral/qbittorrent-native/bin # uname -srm Linux 4.9.119 aarch64

ivan-yu avatar Apr 30 '24 21:04 ivan-yu

It seems the root cause is statx() failing, when trying to get file size.

statx() seems to only exist from Linux Kernel 4.11

If anyone is running earlier version (e.g. Linux Kernel 4.9), this call will fail

ivan-yu avatar May 06 '24 15:05 ivan-yu

Is it possible you can strace to see if you can identify any helpful causes?

userdocs avatar May 06 '24 23:05 userdocs

Also can you provide asus nas specs

userdocs avatar May 06 '24 23:05 userdocs

Please see below strace (strace of non daemon qbittorrent)

openat(AT_FDCWD, "/usr/local/AppCentral/qbittorrent-native/home/.config/qBittorrent/watched_folders.json", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 74
fcntl(74, F_SETFD, FD_CLOEXEC)          = 0
statx(74, "", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_ALL, {stx_mask=STATX_GID|STATX_INO|STATX_SIZE|0xdb06c000, stx_attributes=STATX_ATTR_IMMUTABLE|STATX_ATTR_ENCRYPTED|STATX_ATTR_AUTOMOUNT|STATX_ATTR_MOUNT_ROOT|STATX_ATTR_VERITY|0x7f7b068080, stx_size=549135500224, ...}) = 0
statx(74, "", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_ALL, {stx_mask=STATX_TYPE|STATX_ATIME, stx_attributes=STATX_ATTR_IMMUTABLE|STATX_ATTR_APPEND|STATX_ATTR_NODUMP|STATX_ATTR_ENCRYPTED|STATX_ATTR_AUTOMOUNT|STATX_ATTR_MOUNT_ROOT|STATX_ATTR_VERITY|0x7f7b068100, stx_mode=0177, ...}) = 0
close(74)                               = 0

My Asus NAS is

root@IVAN-NAS:/volume1/.@root # uname -a
Linux IVAN-NAS 4.9.119 #1 SMP PREEMPT Thu Apr 11 03:15:19 CST 2024 aarch64 GNU/Linux

statx() exists from Linux Kernel 4.11

But as I mentioned, if I run 4.6.3-LT2.0.9, I do not have this file open failure issue.

When I run 4.6.3-LT2.0.10, statx() fails, which makes sense since my Linux kernel is only 4.9 and not 4.11

ivan-yu avatar May 07 '24 01:05 ivan-yu

Also, can you please provide the model of the nas device.

userdocs avatar May 07 '24 20:05 userdocs

Asus NAS AS3304T https://www.asustor.com/product?p_id=73

Linux 4.9.119 #1 SMP PREEMPT Thu Apr 11 03:15:19 CST 2024 aarch64 GNU/Linux

ivan-yu avatar May 07 '24 21:05 ivan-yu

So this is the musl dev https://web.archive.org/web/20220602042524/https://twitter.com/RichFelker/status/1357733309737021444

If you want some insight to the issue to use with Asus support (which is really an engineering issue that would need to be escalated) you can ask in the irc (where i did, so they will already be familiar with the issue)

Public support for musl is available via the mailing list and #musl on ircs://libera.chat:6697/musl on the Libera.Chat IRC network.

userdocs avatar May 08 '24 20:05 userdocs

Edit: This is the main answer you need if you come across this issue, the other comments are noisy. The thread was trimmed down/hidden to be more directly helpful to future readers.

This stuff is all above my paygrade. As said to discuss technical aspects you need to use one of their communication channels, like mailing lists.

As far as I understand it it's not the fallback failing but rather the kernel appearing to support statx because it is using the expected syscall for something else so returning some nonsense when used, evidenced via strace.

So I have some options to consider.

1: Very kindly, I was provided a patch to disable these newer calls on older devices by the applications https://sprunge.us/Hzz1iT but I'll still have to work out how to best implement it.

/*
 * fix for broken synology-kernel NAS devices that stole a bunch of syscall
 * numbers for their own MSDOS emulation purposes. link into application
 * to block SYS_statx and all newer/later syscalls with seccomp. */

#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <errno.h>

#include <sys/prctl.h>
#include <linux/seccomp.h>
#include <linux/filter.h>

__attribute__((__constructor__))
static void fix_synology(void)
{
	struct sock_filter filter[4];
	struct sock_fprog prog = {
		.len = sizeof filter / sizeof *filter,
		.filter = filter,
	};

	filter[0] = (struct sock_filter)BPF_STMT(BPF_LD|BPF_W|BPF_ABS, offsetof(struct seccomp_data, nr));
	filter[1] = (struct sock_filter)BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, SYS_statx, 0, 1);
	filter[2] = (struct sock_filter)BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ERRNO|ENOSYS);
	filter[3] = (struct sock_filter)BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW);

	prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0);
	if (syscall(SYS_seccomp, SECCOMP_SET_MODE_FILTER, 0, &prog)) abort();
}

2: build using older musl before v1.2.5.

But as of right now, this is an upstream issue I cannot fix directly, all I can do it work around it.

userdocs avatar May 09 '24 08:05 userdocs

Please also remember the glibc version failed as well. This is not a musl specific issue.

userdocs avatar May 09 '24 08:05 userdocs

I will provide this information to Asus NAS engineer as well to investigate their kernel, thank you for the explanation.

ivan-yu avatar May 09 '24 14:05 ivan-yu

I am closing this as an issue as it's not an issue here and if there will be a solution I will introduce it via a separate repo.

userdocs avatar May 14 '24 18:05 userdocs

Try these builds please

https://github.com/userdocs/qbittorrent-nox-static-test/releases/tag/release-4.6.5_v2.0.10 https://github.com/userdocs/qbittorrent-nox-static-test/releases/tag/release-4.6.5_v1.2.19

userdocs avatar Jun 01 '24 13:06 userdocs

The builds work perfectly on my Asus NAS (which has incorrect hooks for statx())

ivan-yu avatar Jun 02 '24 01:06 ivan-yu

Hello, do you think you can build 4.6.6 with older musl (without statx)?

I am still pushing Asus to fix their kernel, but still no update...

Thanks in advance.

ivan-yu avatar Aug 28 '24 14:08 ivan-yu

In the test repo like before?

userdocs avatar Aug 28 '24 16:08 userdocs

Yes, build with older musl in test repo, I really appreciate your time and help on this.

ivan-yu avatar Aug 28 '24 16:08 ivan-yu

Hi, would you be able to build 4.6.6 with older musl (without statx)?

ivan-yu avatar Sep 16 '24 14:09 ivan-yu

Try these

https://github.com/userdocs/qbittorrent-nox-static-test/releases/tag/release-4.6.7_v1.2.19

https://github.com/userdocs/qbittorrent-nox-static-test/releases/tag/release-4.6.7_v2.0.10

userdocs avatar Sep 21 '24 21:09 userdocs

Thank you so much! They worked on my crippled Asustor NAS kernel.

ivan-yu avatar Sep 22 '24 00:09 ivan-yu