CPU spin in pipewire reading inotify fd -> EAGAIN
- PipeWire version (
pipewire --version
): 0.3.79 - Distribution and distribution version (
PRETTY_NAME
from/etc/os-release
): Fedora Linux 37 (Workstation Edition) - Desktop Environment: Gnome
- Kernel version (
uname -r
): 6.4.15-100.fc37.x86_64
Description of Problem:
After a system suspend (which may also involve USB device removal if I've switched my KVM, which switches a camera, to the other laptop), pipewire starts to use 100% CPU.
strace:
epoll_wait(4, [{events=EPOLLIN, data={u32=3335551552, u64=93964335086144}}, {events=EPOLLIN, data={u32=3335551632, u64=93964335086224}}], 32, 0) = 2
read(33, 0x7fffd0ce0750, 272) = -1 EAGAIN (Resource temporarily unavailable)
read(34, 0x7fffd0ce0750, 272) = -1 EAGAIN (Resource temporarily unavailable)
write(3, "\1\0\0\0\0\0\0\0", 8) = 8
poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=20, events=POLLIN}, {fd=24, events=POLLIN}], 4, 0) = 2 ([{fd=3, revents=POLLIN}, {fd=4, revents=POLLIN}])
read(3, "\2\0\0\0\0\0\0\0", 16) = 8
write(3, "\1\0\0\0\0\0\0\0", 8) = 8
epoll_wait(4, [{events=EPOLLIN, data={u32=3335551552, u64=93964335086144}}, {events=EPOLLIN, data={u32=3335551632, u64=93964335086224}}], 32, 0) = 2
read(33, 0x7fffd0ce0750, 272) = -1 EAGAIN (Resource temporarily unavailable)
read(34, 0x7fffd0ce0750, 272) = -1 EAGAIN (Resource temporarily unavailable)
FD 4 is the epoll FD:
[abartlet@jesse ~]$ cat /proc/139532/fdinfo/4
pos: 0
flags: 02000002
mnt_id: 15
ino: 2074
tfd: 33 events: 19 data: 5575c6d07a40 pos:0 ino:81a sdev:e
tfd: 30 events: 19 data: 5575c6cbbd88 pos:0 ino:25614e sdev:8
tfd: 28 events: 18 data: 5575c6d70790 pos:0 ino:25614b sdev:8
tfd: 29 events: 19 data: 5575c6d70830 pos:0 ino:25614b sdev:8
tfd: 26 events: 19 data: 5575c6d6e3b0 pos:0 ino:81a sdev:e
tfd: 32 events: 19 data: 5575c6cbbdb8 pos:0 ino:81a sdev:e
tfd: 19 events: 19 data: 5575c6bf01c0 pos:0 ino:25613a sdev:8
tfd: 10 events: 19 data: 5575c6b9ae10 pos:0 ino:81a sdev:e
tfd: 35 events: 19 data: 5575c6d07a40 pos:0 ino:81a sdev:e
tfd: 36 events: 19 data: 5575c6d07a90 pos:0 ino:81a sdev:e
tfd: 34 events: 19 data: 5575c6d07a90 pos:0 ino:81a sdev:e
tfd: 37 events: 19 data: 5575c6d08d90 pos:0 ino:255eaa sdev:8
tfd: 5 events: 19 data: 5575c6b87a70 pos:0 ino:81a sdev:e
tfd: 23 events: 19 data: 5575c6bfd2e0 pos:0 ino:25613b sdev:8
tfd: 31 events: 19 data: 5575c6d71df0 pos:0 ino:81a sdev:e
tfd: 40 events: 39 data: 5575c6da4510 pos:0 ino:3dc sdev:5
FD 33 and 34 are Inotify FDs:
[abartlet@jesse ~]$ cat /proc/139532/fdinfo/34
pos: 0
flags: 02004000
mnt_id: 15
ino: 2074
inotify wd:1 ino:b18 sdev:5 mask:c ignored_mask:0 fhandle-bytes:c fhandle-type:1 f_handle:08ed941d180b000000000000
[abartlet@jesse ~]$ cat /proc/139532/fdinfo/33
pos: 0
flags: 02004000
mnt_id: 15
ino: 2074
inotify wd:1 ino:b17 sdev:5 mask:c ignored_mask:0 fhandle-bytes:c fhandle-type:1 f_handle:2dbaf745170b000000000000
Each read call returns -1 and EAGAIN:
Thread 1 "wireplumber" hit Breakpoint 5.1, __GI___libc_read (fd=34, buf=buf@entry=0x7fffd0ce0750, nbytes=nbytes@entry=272) at ../sysdeps/unix/sysv/linux/read.c:25
25 {
(gdb) fin
Run till exit from #0 __GI___libc_read (fd=34, buf=buf@entry=0x7fffd0ce0750, nbytes=nbytes@entry=272) at ../sysdeps/unix/sysv/linux/read.c:25
Thread 1 "wireplumber" hit Breakpoint 5.2, __GI___libc_read (nbytes=272, buf=0x7fffd0ce0750, fd=34) at ../sysdeps/unix/sysv/linux/read.c:26
26 return SYSCALL_CANCEL (read, fd, buf, nbytes);
(gdb) fin
Run till exit from #0 __GI___libc_read (nbytes=272, buf=0x7fffd0ce0750, fd=34) at ../sysdeps/unix/sysv/linux/read.c:26
__GI___libc_read (fd=34, buf=buf@entry=0x7fffd0ce0750, nbytes=nbytes@entry=272) at ../sysdeps/unix/sysv/linux/read.c:24
24 __libc_read (int fd, void *buf, size_t nbytes)
(gdb) fin
Run till exit from #0 __GI___libc_read (fd=34, buf=buf@entry=0x7fffd0ce0750, nbytes=nbytes@entry=272) at ../sysdeps/unix/sysv/linux/read.c:24
impl_on_notify_events (source=0x5575c6d07a90) at ../spa/plugins/v4l2/v4l2-udev.c:429
429 if (len < 0 && errno != EAGAIN)
Value returned is $14 = -1
(gdb) p errno
$15 = 11
(11 is EAGAIN on this host)
How Reproducible:
Happens every now and then, started happening about 3 months ago.
Steps to Reproduce:
(roughly)
- suspend laptop
- switch USB
- resume laptop
Actual Results:
pipewire in CPU spin, applications using audio hang
Expected Results:
Good audio, no hang
Additional Info (as attachments):
-
pw-dump > pw-dump.log
: