Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • pipewire pipewire
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 581
    • Issues 581
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 22
    • Merge requests 22
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • PipeWirePipeWire
  • pipewirepipewire
  • Issues
  • #1061
Closed
Open
Issue created Apr 17, 2021 by Janne Hakonen@jhakonen

pw-loopback crashes when terminated

Version: master (f27ad659)
Distribution: Pop OS 20.04
Desktop Environment: GNOME

Description of Problem:

When pw-loopback is set to capture virtual audio source it crashes sometimes when terminated.

How Reproducible:

~1%

Steps to Reproduce:

  1. Create script ./test:
#!/bin/bash
set -e

SOURCE_NAME="Test Audio Source"

pw-cli create-node adapter "{ \
	factory.name=support.null-audio-sink \
	object.linger=1 \
	node.name=\"$SOURCE_NAME\" \
	media.class=\"Audio/Source/Virtual\" \
	audio.position=[FL,FR] \
}"

NODE_ID=$(pw-dump -N | jq -r --arg name "$SOURCE_NAME" \
  '.[] | select(.info.props["node.name"]==$name) | .id')

trap 'pw-cli destroy $NODE_ID' SIGINT SIGTERM EXIT

let i=1
while :; do
	echo "Try #$i"

	pw-loopback --capture $NODE_ID &
	sleep 0.1
	# Terminate pw-loopback process
	kill $!
	# Check exit code of the backgrounded pw-loopback process, 'set -e' exits
	# this script if the process had crashed
	wait $!

	let i++
done
  1. Run the script

Actual Results:

$ ulimit -c unlimited
$ ./test
1 = @proxy:77
Try #1
Try #2
...
Try #87
./test: line 29: 50255 Segmentation fault      (core dumped) pw-loopback --capture $NODE_ID
remote 0 port 115 changed
remote 0 port 114 changed
remote 0 port 116 changed
remote 0 port 81 changed

$ gdb pw-loopback core
...
Reading symbols from pw-loopback...
[New LWP 50257]
[New LWP 50255]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `pw-loopback --capture 91'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:383
383	../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S: No such file or directory.
[Current thread is 1 (Thread 0x7f8c01689700 (LWP 50257))]

(gdb) thread apply all bt

Thread 2 (Thread 0x7f8c02ad6b80 (LWP 50255)):
#0  __GI__dl_catch_exception (exception=exception@entry=0x7ffd59617000, operate=operate@entry=0x7f8c02afc420 <dlclose_doit>, args=args@entry=0x561925a3ab90) at dl-error-skeleton.c:211
#1  0x00007f8c02c64983 in __GI__dl_catch_error (objname=objname@entry=0x5619259e55c0, errstring=errstring@entry=0x5619259e55c8, mallocedp=mallocedp@entry=0x5619259e55b8, operate=operate@entry=0x7f8c02afc420 <dlclose_doit>, args=args@entry=0x561925a3ab90) at dl-error-skeleton.c:227
#2  0x00007f8c02afcb59 in _dlerror_run (operate=operate@entry=0x7f8c02afc420 <dlclose_doit>, args=0x561925a3ab90) at dlerror.c:170
#3  0x00007f8c02afc468 in __dlclose (handle=<optimized out>) at dlclose.c:46
#4  0x00007f8c02d574b9 in unref_plugin (plugin=0x561925a3b120) at ../src/pipewire/pipewire.c:165
#5  0x00007f8c02d57524 in unref_plugin (plugin=<optimized out>) at ../src/pipewire/pipewire.c:161
#6  unref_handle (handle=0x7f8c00116010) at ../src/pipewire/pipewire.c:204
#7  0x00007f8c02d57c7d in unref_handle (handle=<optimized out>) at ../src/pipewire/pipewire.c:305
#8  pw_unload_spa_handle (handle=<optimized out>) at ../src/pipewire/pipewire.c:322
#9  0x00007f8c02d5dfc9 in pw_impl_port_set_mix (port=port@entry=0x561925a34ac0, node=0x561925a35120, node@entry=0x0, flags=flags@entry=0) at ../src/pipewire/impl-port.c:515
#10 0x00007f8c02d60319 in pw_impl_port_remove (port=0x561925a34ac0) at ../src/pipewire/impl-port.c:1025
#11 pw_impl_port_destroy (port=0x561925a34ac0) at ../src/pipewire/impl-port.c:1049
#12 0x00007f8c02d5486d in pw_impl_node_destroy (node=0x561925a2a650) at ../src/pipewire/impl-node.c:1766
#13 0x00007f8c02d71c9e in pw_stream_disconnect (stream=0x561925a211d0) at ../src/pipewire/stream.c:1707
#14 pw_stream_disconnect (stream=0x561925a211d0) at ../src/pipewire/stream.c:1687
#15 0x00007f8c02d2fed5 in proxy_core_removed (data=0x561925a04560) at ../src/pipewire/core.c:213
#16 proxy_core_removed (data=0x561925a04560) at ../src/pipewire/core.c:198
#17 0x00007f8c02d64900 in pw_proxy_remove (proxy=proxy@entry=0x561925a04560) at ../src/pipewire/proxy.c:284
#18 0x00007f8c02d30afc in pw_core_disconnect (core=0x561925a04560) at ../src/pipewire/core.c:495
#19 0x0000561924f82769 in main (argc=<optimized out>, argv=<optimized out>) at ../src/tools/pw-loopback.c:323

Thread 1 (Thread 0x7f8c01689700 (LWP 50257)):
#0  __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:383
#1  0x00007f8c00d363c7 in memcpy (__len=<optimized out>, __src=<optimized out>, __dest=<optimized out>) at /usr/include/x86_64-linux-gnu/bits/string_fortified.h:34
#2  impl_node_process (object=0x7f8c0060ec78) at ../spa/plugins/audioconvert/resample.c:872
#3  0x00007f8c00d01b77 in impl_node_process (object=<optimized out>) at ../spa/plugins/audioconvert/audioconvert.c:1139
#4  impl_node_process (object=0x7f8c003ad3c0) at ../spa/plugins/audioconvert/audioconvert.c:1125
#5  0x00007f8c00cf4aa8 in impl_node_process (object=0x7f8c003ad038) at ../spa/plugins/audioconvert/audioadapter.c:1026
#6  0x00007f8c02d4ed39 in process_node (data=0x561925a2e160) at ../src/pipewire/impl-node.c:1040
--Type <RET> for more, q to quit, c to continue without paging--
#7  0x00007f8c02d4d21c in node_on_fd_events (source=<optimized out>) at ../src/pipewire/impl-node.c:1098
#8  0x00007f8c02dc9463 in loop_iterate (object=0x5619259f7538, timeout=<optimized out>) at ../spa/plugins/support/loop.c:308
#9  0x00007f8c02d30e90 in do_loop (user_data=0x5619259f7390) at ../src/pipewire/data-loop.c:79
#10 0x00007f8c02ae1609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#11 0x00007f8c02c23293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb) 

The crash might happen only after a few retries, or could take over hundred of retries.

Expected Results:

No crash.

Assignee
Assign to
Time tracking