Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault if Pipewire not available #10859

Closed
sfan5 opened this issue Nov 13, 2022 · 15 comments
Closed

Segfault if Pipewire not available #10859

sfan5 opened this issue Nov 13, 2022 · 15 comments

Comments

@sfan5
Copy link
Member

sfan5 commented Nov 13, 2022

Thoughts:
seriously

Backtrace:

(gdb) r
Starting program: /home/stefan/mpv/build/mpv --no-config -v av://lavfi:anullsrc

[Thread debugging using libthread_db enabled]                                                          
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[cplayer] Command line options: '--no-config' '-v' 'av://lavfi:anullsrc'
[cplayer] mpv 0.35.0-2-g1e9a2cbebf Copyright © 2000-2022 mpv/MPlayer/mplayer2 projects
[cplayer]  built on Sun Nov 13 02:13:03 2022
[cplayer] FFmpeg library versions:
[cplayer]    libavutil       57.42.100
[cplayer]    libavcodec      59.52.101
[cplayer]    libavformat     59.34.101
[cplayer]    libswscale      6.8.112
[cplayer]    libavfilter     8.50.100
[cplayer]    libswresample   4.9.100
[cplayer] FFmpeg version: N-109069-gbfab87a61d
[cplayer] 
[cplayer] Configuration: meson configure build -Dprefix=/usr/local -Dbuildtype=debugoptimized -Doptimization=2
[cplayer] List of enabled features: alsa av-channel-layout build-date cplayer cplugins debug dmabuf-interop-gl dmabuf-interop-pl drm drm-is-kms egl egl-drm egl-helpers egl-x11 ffmpeg gbm gl gl-x11 glibc-thread-name glob glob-posix gpl iconv jack jpeg jpegxl lcms2 libarchive libass libavdevice libbluray libdl libm libplacebo libplacebo-next librt linux-fstatfs lua52 manpage-build noexecstack pipewire posix pulse shaderc stdatomic threads uchardet vaapi vaapi-drm vaapi-egl vaapi-libplacebo vaapi-x-egl vaapi-x11 vapoursynth vector vt.h vulkan x11 xv zimg zlib
[cplayer] Setting option 'config' = 'no' (flags = 8)
[cplayer] Setting option 'v' = '' (flags = 8)
[New Thread 0x7fffeef446c0 (LWP 1472909)]
[New Thread 0x7fffee7436c0 (LWP 1472910)]
[New Thread 0x7fffedf426c0 (LWP 1472911)]
[New Thread 0x7fffed7416c0 (LWP 1472912)]
[New Thread 0x7fffecf406c0 (LWP 1472913)]
[New Thread 0x7fffd7fff6c0 (LWP 1472914)]
[cplayer] Waiting for scripts...
[osd/libass] libass API version: 0x1600000
[osd/libass] libass source: commit: 0.16.0-0-g1af6240c5d1e499326146e0b88c987e626b13c23-dirty
[osd/libass] Shaper: FriBidi 1.0.12 (SIMPLE) HarfBuzz-ng 5.3.1 (COMPLEX)
[osd/libass] Setting up fonts...
[osd/libass] Using font provider fontconfig
[osd/libass] Done.
[Thread 0x7fffd7fff6c0 (LWP 1472914) exited]
[cplayer] Set property: shared-script-properties -> 1
[cplayer] Set property: shared-script-properties -> 1
[cplayer] Done loading scripts.
[cplayer] Running hook: ytdl_hook/on_load
[ytdl_hook] ytdl:// hook 
[ytdl_hook] not a ytdl:// url 
[New Thread 0x7fffd7fff6c0 (LWP 1472915)]
[avdevice] Opening av://lavfi:anullsrc
[demux] Trying demuxers for level=request.
[cplayer] Set property: shared-script-properties -> 1
[osd/libass] libass API version: 0x1600000
[osd/libass] libass source: commit: 0.16.0-0-g1af6240c5d1e499326146e0b88c987e626b13c23-dirty
[osd/libass] Shaper: FriBidi 1.0.12 (SIMPLE) HarfBuzz-ng 5.3.1 (COMPLEX)
[osd/libass] Setting up fonts...
[lavf] Found 'lavfi' at score=100 size=0 (forced).
[New Thread 0x7fffd77fe6c0 (LWP 1472916)]
[New Thread 0x7fffd6ffd6c0 (LWP 1472917)]
[New Thread 0x7fffd67fc6c0 (LWP 1472918)]
[New Thread 0x7fffd5ffb6c0 (LWP 1472919)]
[New Thread 0x7fffd57fa6c0 (LWP 1472920)]
[New Thread 0x7fffd4ff96c0 (LWP 1472921)]
[New Thread 0x7fffd47f86c0 (LWP 1472922)]
[New Thread 0x7fffd3ff76c0 (LWP 1472923)]
[New Thread 0x7fffd37f66c0 (LWP 1472924)]
[New Thread 0x7fffd2ff56c0 (LWP 1472925)]
[New Thread 0x7fffd27f46c0 (LWP 1472926)]
[New Thread 0x7fffd1ff36c0 (LWP 1472927)]
[lavf] Could not set AVOption user_agent='libmpv'
[lavf] Could not set AVOption tls_verify='0'
[lavf] Could not set AVOption icy='1'
[lavf] Could not set AVOption timeout='60000000'
[lavf] avformat_find_stream_info() finished after 0 bytes.
[demux] Detected file format: lavfi (libavformat)
[cplayer] Opening done: av://lavfi:anullsrc
[Thread 0x7fffd7fff6c0 (LWP 1472915) exited]
[osd/libass] Using font provider fontconfig
[osd/libass] Done.
[New Thread 0x7fffd7fff6c0 (LWP 1472928)]
[New Thread 0x7fffd17f26c0 (LWP 1472929)]
[cplayer] Running hook: ytdl_hook/on_preloaded
[lavf] select track 0
[cplayer]  (+) Audio --aid=1 (pcm_u8 2ch 44100Hz)
[ad] Codec list:
[ad]     pcm_u8 - PCM unsigned 8-bit
[ad] Opening decoder pcm_u8
[ad] Requesting 1 threads for decoding.
[ad] Selected codec: pcm_u8 (PCM unsigned 8-bit)
[af] User filter list:
[af]   (empty)
[cplayer] Starting playback...
[cplayer] Set property: shared-script-properties -> 1
[af] [in] 44100Hz stereo 2ch u8
[af] [userspeed] 44100Hz stereo 2ch u8
[af] [userspeed] (disabled)
[af] [convert] 44100Hz stereo 2ch u8
[ao] Trying audio driver 'pipewire'
[ao/pipewire] requested format: 44100 Hz, stereo channels, u8
[New Thread 0x7fffd0ff16c0 (LWP 1472930)]
[New Thread 0x7fffcbfff6c0 (LWP 1472931)]
[ao/pipewire] Could not connect to context '(null)': Host is down
'!impl->polling' failed at ../pipewire/spa/plugins/support/loop.c:872 impl_clear()
[Thread 0x7fffd0ff16c0 (LWP 1472930) exited]

Thread 1 "mpv" received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
44	      return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
(gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, 
    no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007ffff563d6b3 in __pthread_kill_internal (signo=6, threadid=<optimized out>)
    at pthread_kill.c:78
#2  0x00007ffff55ed958 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007ffff55d753d in __GI_abort () at abort.c:79
#4  0x00007fffec0a8a84 in ?? () from /usr/lib/spa-0.2/support/libspa-support.so
#5  0x00007ffff5cb4160 in ?? () from /usr/lib/libpipewire-0.3.so.0
#6  0x00007ffff5cb73fb in pw_deinit () from /usr/lib/libpipewire-0.3.so.0
#7  0x0000555555690230 in uninit (ao=<optimized out>) at ../audio/out/ao_pipewire.c:300
#8  0x000055555569451a in init (ao=0x55555589e3d0) at ../audio/out/ao_pipewire.c:564
#9  0x00005555555b8c0f in ao_init (probing=probing@entry=true, global=global@entry=0x5555557ff010, 
    wakeup_cb=wakeup_cb@entry=0x555555633b80 <mp_wakeup_core_cb>, 
    wakeup_ctx=wakeup_ctx@entry=0x5555557fe730, encode_lavc_ctx=encode_lavc_ctx@entry=0x0, 
    flags=flags@entry=2, samplerate=44100, format=1, channels=..., dev=0x0, 
    name=0x55555572448c "pipewire") at ../audio/out/ao.c:218
#10 0x00005555555b9282 in ao_init_best (global=0x5555557ff010, init_flags=init_flags@entry=2, 
    wakeup_cb=0x555555633b80 <mp_wakeup_core_cb>, wakeup_ctx=wakeup_ctx@entry=0x5555557fe730, 
    encode_lavc_ctx=0x0, samplerate=samplerate@entry=44100, format=1, channels=...)
    at ../audio/out/ao.c:339
#11 0x0000555555615602 in reinit_audio_filters_and_output (mpctx=0x5555557fe730)
    at ../player/audio.c:441
#12 0x00005555556163c8 in fill_audio_out_buffers (mpctx=mpctx@entry=0x5555557fe730)
    at ../player/audio.c:884
#13 0x0000555555636231 in run_playloop (mpctx=mpctx@entry=0x5555557fe730) at ../player/playloop.c:1212
#14 0x000055555562f4e7 in play_current_file (mpctx=0x5555557fe730) at ../player/loadfile.c:1679
#15 0x00005555556305e9 in mp_play_files (mpctx=mpctx@entry=0x5555557fe730) at ../player/loadfile.c:1865
#16 0x0000555555631310 in mpv_main (argc=<optimized out>, argv=<optimized out>) at ../player/main.c:432
#17 0x00007ffff55d8290 in __libc_start_call_main (main=main@entry=0x5555555af620 <main>, 
    argc=argc@entry=4, argv=argv@entry=0x7fffffffded8) at ../sysdeps/nptl/libc_start_call_main.h:58
#18 0x00007ffff55d834a in __libc_start_main_impl (main=0x5555555af620 <main>, argc=4, argv=0x7fffffffded8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdec8) at ../csu/libc-start.c:381
#19 0x00005555555af655 in _start () at ../sysdeps/x86_64/start.S:115

Possible environment peculiarities:
I have the pipewire.socket user unit masked to avoid pipewire from even doing anything at all on my system (this might be a bad idea, who knows?).

@philipl
Copy link
Member

philipl commented Nov 13, 2022

@t-8ch

@Dudemanguy
Copy link
Member

For what it's worth, if I don't have the pipewire user service running on my system (s6-rc service not systemd), I don't get this; the AO just errors out normally. No clue why masking the socket would result in anything different though (presumably this has the same effect as preventing the daemon from running at all).

@t-8ch
Copy link
Contributor

t-8ch commented Nov 13, 2022

Ouch. I can only look at this in a few hours.

@t-8ch
Copy link
Contributor

t-8ch commented Nov 14, 2022

@sfan5 Which version of pipewire are you using? I can't reproduce it on 0.3.60.

I can vaguely remember something similar fixed in pipewire, I'll try to look it up.

Maybe we should add some logging to the AO to report the version. (#10863)

@sfan5
Copy link
Member Author

sfan5 commented Nov 14, 2022

[ao/pipewire] Headers version: 0.3.59
[ao/pipewire] Library version: 0.3.59

More exact: the package built from https://github.com/archlinux/svntogit-packages/tree/5dcef66c656839c179ddcd4dcdc279b8dcf9f483/trunk

@t-8ch
Copy link
Contributor

t-8ch commented Nov 14, 2022

Is it reliably reproducible for you?

Can you create some logs with the env variable PIPEWIRE_DEBUG?

Does it reproduce with the Arch binary package?
Can you send me a coredump and logging from that?

@t-8ch
Copy link
Contributor

t-8ch commented Nov 14, 2022

FYI you can use debuginfod to get automatic debug symbols for all repo packages.

@sfan5
Copy link
Member Author

sfan5 commented Nov 14, 2022

Yes, it's 100% reliable. Updated my entire system just now too, didn't help.

Didn't try the upstream pkg but here's a fresh log https://0x0.st/o6hD.txt
I can send you my binary and a coredump if that helps.

@sfan5
Copy link
Member Author

sfan5 commented Nov 14, 2022

You're right though that is must be something about my system because I can't reproduce it in a clean container with mpv & pipewire from testing or from extra or self-compiled.

@t-8ch
Copy link
Contributor

t-8ch commented Nov 14, 2022

I would really like to have a test with the Arch package. It would show us if it's an issue with the system or the build.
Furthermore we have a well-defined set of dependencies and can easily get debug symbols for all parts of the application.

@suicide
Copy link

suicide commented Nov 15, 2022

I ran into the same issue earlier on arch. Update to pipewire 0.3.60 fixed it.

@t-8ch
Copy link
Contributor

t-8ch commented Nov 15, 2022

@suicide
Was this with packages from the repos?
Was it also reproducible?

In 0.3.60 the assert() was removed so this issue is maybe just hidden.

@suicide
Copy link

suicide commented Nov 15, 2022

@t-8ch
I encountered the error earlier when I received the update 0.34.1-5 -> 0.35.0-2 from the arch community repo. I downgraded for the time being and could play videos just fine again.
Later pipewire was updated 0.3.59-5 -> 0.3.60-1 from the arch extras repo and I updated mpv again to 0.35.0-2. Videos were working fine now with the latest versions from the repo.

I just tried downgrading pipewire again but I could not reproduce the error with mpv 0.35

@sfan5
Copy link
Member Author

sfan5 commented Nov 15, 2022

I would really like to have a test with the Arch package.

Still happens, https://0x0.st/oIq2.txt
core file: https://0x0.st/oIq9.74083.zs

Furthermore we have a well-defined set of dependencies [...]

Well not really, I run ffmpeg-git on my system which shouldn't but could play a part.

@sfan5
Copy link
Member Author

sfan5 commented Nov 15, 2022

In any case upgrading to pipewire 1:0.3.60-1 fixed this which is good enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants