[Bug 194727] uaudio device gets disconnected, and hangs usb until everything using /dev/mixer* is closed

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 25 May 2022 21:26:45 UTC

--- Comment #76 from Hans Petter Selasky <hselasky@FreeBSD.org> ---
(In reply to Hans Petter Selasky from comment #71)
> My complaint, and I think others have expressed this, is that a misbehaving 
> application should not prevent me from using the USB port the sound card was 
> inserted previously. A misbehaving application should not have the level of 
> control of the system. While PulseAudio is having an issue, the handling of 
> this situation needs to be more robust.


The only responsibility of the kernel is to garbage collect memory and
resources which are not freed when a user-space application exits.

For example if you open a shared FIFO and don't read the data which is written
there, the writer will eventually be blocked as the internal buffer it has is
used up!

The same with USB. If you get any handle on a USB device, and don't free it
when the device vanishes, the kernel will wait enumerating further devices,
because it not only wants the memory back it also wants to free up unit numbers
for coming character device nodes.

I'm not willing to leak memory as a compromise for faulty applications. But I
could be willing to implement a kill after timeout sysctl, that if an
application using USB resources does not free up its handles and such, it gets
automagically killed, like out of memory, OOM.

What do you think about that?

Applications and the kernel are in a symbiosis and must "talk" to each other
correctly for things to work in the end. It's like a protocol.

Audio applications may need realtime priority for example, to process audio in
time, but if they are broken, they may go looping and use 100% CPU and lock
your system anyway.

Again, if your application leaks file descriptors, and you think it is a bug, I
would fix the application and not the kernel.


You are receiving this mail because:
You are on the CC list for the bug.