segfault in pipewire when using ladspa plugin
I'm experiencing a segfault in pipewire when using the ladspa plugin:
(gdb) run
Starting program: /usr/bin/pipewire -c filter-chain.conf
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7fffe9b9b6c0 (LWP 66372)]
[New Thread 0x7fffe922d6c0 (LWP 66373)]
2025-06-15T03:54:17.032Z | DEBUG | df::tract | Loading model DeepFilterNet3_ll_onnx.tar.gz
Thread 3 "data-loop.0" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe922d6c0 (LWP 66373)]
ladspa::ffi::connect_port (instance=0x0, port_num=0, data_location=0x7fffe88f10c0) at src/ffi.rs:236
236 let port = handle.descriptor.ports[port_num as usize];
(gdb) p handle
$2 = (*mut ladspa::ffi::Handle) 0x0
(gdb) list
231 port_num: c_ulong,
232 data_location: *mut ladspa_h::Data) {
233 unsafe {
234 let handle: &mut Handle = mem::transmute(instance);
235
236 let port = handle.descriptor.ports[port_num as usize];
237
238 // Create appropriate pointers to port data. Mutable locations are wrapped in refcells.
239 let data = match port.desc {
240 super::PortDescriptor::AudioInput => {
(gdb) bt
#0 ladspa::ffi::connect_port (instance=0x0, port_num=0, data_location=0x7fffe88f10c0) at src/ffi.rs:236
#1 0x00007fffe8a01f71 in impl_process (object=0x5555555a7c98, in=<optimized out>, out=0x7fffe922c270, n_samples=1024)
at ../spa/plugins/filter-graph/filter-graph.c:250
#2 0x00007ffff7c7c8b3 in spa_filter_graph_process (object=<optimized out>, in=0x7fffe922c670, out=0x7fffe922c270, n_samples=1024)
at ../spa/include/spa/filter-graph/filter-graph.h:137
#3 playback_process (d=0x5555555babb0) at ../src/modules/module-filter-chain.c:932
#4 0x00007ffff7f4d619 in call_process (impl=0x55555564c280) at ../src/pipewire/stream.c:450
#5 call_process (impl=0x55555564c280) at ../src/pipewire/stream.c:443
#6 impl_node_process_output (object=0x55555564c280) at ../src/pipewire/stream.c:1127
#7 0x00007fffe8944243 in spa_node_process_fast (object=<optimized out>) at ../spa/include/spa/node/node.h:756
#8 impl_node_process (object=0x55555567ac78) at ../spa/plugins/audioconvert/audioadapter.c:1817
#9 0x00007ffff7f28097 in spa_node_process_fast (object=<optimized out>) at ../spa/include/spa/node/node.h:756
#10 process_node.isra.0 (data=data@entry=0x5555556a4750, nsec=nsec@entry=17845689604530) at ../src/pipewire/impl-node.c:1498
#11 0x00007ffff7f28526 in node_on_fd_events (source=<optimized out>) at ../src/pipewire/impl-node.c:1575
#12 0x00007ffff7c9e7c6 in loop_iterate (object=<optimized out>, timeout=<optimized out>) at ../spa/plugins/support/loop.c:726
#13 0x00007ffff7ef7741 in do_loop (user_data=0x5555555658b0) at ../src/pipewire/data-loop.c:67
#14 0x00007ffff7d5c1d4 in start_thread (arg=<optimized out>) at pthread_create.c:448
#15 0x00007ffff7ddecec in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
(gdb)
You can see that it's entered the plugin due to the log message getting printed, but somehow the instance being returned is NULL.
LADPSA is quite an old plugin hosting format. Are there better ways of hooking this up with Pipewire to avoid the LADPSA interface?
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days.
I'm not sure -- I'm not familiar with the way filters are arranged under Linux.
At any rate, this patch solves the immediate problem of the segfault.
If the author @Rikorose doesn't want to solve this segfault and intends to rewrite it to use a different adapter mechanism, or if this repository is abandoned, then I'll let the bot close the issue and look for another solution.