audioaggregator: Access to pad list while mixing is not thread-safe and leads to invalid memory accesses
Describe your issue
smaller reproduction of my application using the go-gst bindings. This app uses an audiomixer element and continously requests sink pads when needed and releases them when not needed anymore.
After a lot of time (around 144h in my actual application) this creates a deadlock on a gst_bin_add
call. The backtrace shows the following:
- Thread 18 is the one that deadlocks
- Thread 20 calls a signal handler this line that gets handled by the go runtime (but doesn't end the program because the signal isn't handled it seems)
Setup
- Operating System: Arch Linux
- Device: Computer
- GStreamer Version: 1.22.6
Steps to reproduce the bug
I don't have a reliable reproduction, but I think this is a race condition on the sinkpads of the audioaggregator.
How reproducible is the bug?
In my experience it is extremely rare that this happens.
Additional Information
Maybe the handling of the requestpad cleanup is missing a crucial call that could prevent this issue: https://github.com/RSWilli/gstreamer-segfault-reproduction/blob/master/main.go#L58-L75