list corruption and infinte loop
Created by: michaelolbrich
I'm seeing infinite loops in the pipewire daemon (with the current master branch). From what I can tell, the two threads operate on the same list with spa_list_for_each_cursor()
which is not thread save. When I attach gdb, the backtraces look like this:
Thread 2 (Thread 10819.10820):
#0 spa_list_insert (list=0x557aca17be68, elem=0x557aca15f490) at .../spa/include/spa/utils/list.h:44
#1 0x00007fb64379139e in node_have_output (data=0x557aca17bd20) at .../src/pipewire/node.c:546
#2 0x00007fb642b8fa80 in handle_node_message (this=0x7fb64290e038, message=0x7fb64342dc30) at .../src/modules/module-client-node/client-node.c:924
#3 0x00007fb642b903c5 in node_on_data_fd_events (source=0x7fb64290e110) at .../src/modules/module-client-node/client-node.c:1088
#4 0x00007fb6435882cd in loop_iterate (ctrl=0x557aca156998, timeout=-1) at .../spa/plugins/support/loop.c:358
#5 0x00007fb643781d33 in do_loop (user_data=0x557aca14d8d0) at .../src/pipewire/data-loop.c:37
#6 0x00007fb643758003 in start_thread (arg=<optimized out>) at pthread_create.c:486
#7 0x00007fb64368de6f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 1 (Thread 10819.10819):
#0 0x00007fb643791076 in node_event (data=0x557aca17bd20, event=0x557aca1734b0) at .../src/pipewire/node.c:530
#1 0x00007fb642b90175 in client_node_event (data=0x7fb64290e010, event=0x557aca1734b0) at .../src/modules/module-client-node/client-node.c:1047
#2 0x00007fb642b98ebe in client_node_demarshal_event_method (object=0x557aca15f3d0, data=0x557aca1734a8, size=72) at .../src/modules/module-client-node/protocol-native.c:821
#3 0x00007fb642c0adc7 in process_messages (data=0x557aca16b088) at .../src/modules/module-protocol-native.c:237
#4 0x00007fb642c0b086 in connection_data (data=0x557aca16b088, fd=21, mask=SPA_IO_IN) at .../src/modules/module-protocol-native.c:289
#5 0x00007fb643588347 in source_io_func (source=0x557aca16b1a0) at .../spa/plugins/support/loop.c:368
#6 0x00007fb6435882cd in loop_iterate (ctrl=0x557aca14e828, timeout=-1) at .../spa/plugins/support/loop.c:358
#7 0x00007fb64378d461 in pw_main_loop_run (loop=0x557aca14d300) at .../src/pipewire/main-loop.c:123
#8 0x0000557ac84936c4 in main (argc=1, argv=0x7ffeb0224de8) at .../src/daemon/main.c:111
I think the issue is similar to #110 (closed) but I'm not sure if the same fix can be used here as well.