xdg-desktop-portal-wlr: Segfault - While screencasting (firefox nightly WebRTC).

Hi @danshick great work.

I’ve got this working on the Mozilla WebRTC demo in firefox nightly, and can see my screen being shared. After a few seconds I get the following segfault:

I ran the tools with the following command lines:

env PIPEWIRE_DEBUG=3 pipewire 2>&1 | tee pipewire.log
gdb --args xdg-desktop-portal-wlr -p BGRx -l TRACE
/usr/local/libexec/xdg-desktop-portal --verbose -r
(gdb) bt
#0  0x0000005400000003 in ?? ()
#1  0x00007ffff7e9b83b in clear_buffers (stream=stream@entry=0x5555555a67a0) at ../src/pipewire/stream.c:570
#2  0x00007ffff7ea3d64 in impl_port_set_param (object=0x5555555a67a0, direction=<optimised out>, port_id=<optimised out>, id=4, flags=<optimised out>, param=<optimised out>) at ../src/pipewire/stream.c:608
#3  0x00007ffff7e9735e in pw_impl_port_set_param (port=port@entry=0x5555555a8c00, id=id@entry=4, flags=flags@entry=0, param=param@entry=0x0) at ../src/pipewire/impl-port.c:1143
#4  0x00007ffff6989a88 in client_node_port_set_param (object=<optimised out>, direction=<optimised out>, port_id=<optimised out>, id=<optimised out>, flags=0, param=0x0) at ../src/modules/module-client-node/remote-node.c:576
#5  0x00007ffff699b55f in client_node_demarshal_port_set_param (object=0x7ffff68a7010, msg=<optimised out>) at ../src/modules/module-client-node/protocol-native.c:451
#6  0x00007ffff69d361d in process_remote (impl=impl@entry=0x555555594440) at ../src/modules/module-protocol-native.c:667
#7  0x00007ffff69d3b78 in on_remote_data (data=0x555555594440, fd=<optimised out>, mask=<optimised out>) at ../src/modules/module-protocol-native.c:707
#8  0x00007ffff7fc3edc in loop_iterate (object=0x55555556ef28, timeout=<optimised out>) at ../spa/plugins/support/loop.c:302
#9  0x0000555555557d8a in main ()
(gdb) 

Let me know if I can get more information or help you debug. I’ve pulled everything from the latest master branch and compiled.

pipewire.log

Thanks for your efforts.

James

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 18 (1 by maintainers)

Most upvoted comments

You should be able to make something work using the aur source https://aur.tuna.tsinghua.edu.cn/packages/fedora-firefox-wayland-bin/. There’s a rpm listed there and some changes can be followed in the PKGBUILD (see prepare section). Hope this helps.

Okay, I’ve never tested a version of Firefox with these specific patches. I can’t promise I’ll be able to reproduce this soon, but I’ll see what I can do. Flatpak really complicates things.

Hi @danshick @soyuka

I’m using the flatpak built nightly with built-in support from: https://firefox-flatpak.mojefedora.cz/

Also I’m on Ubuntu 20.04, but most of the packages in play here are self compiled (AFAIK).

Just did a flatpak update to the latest and get the same result.

Best

James

I just noticed @jameswalmsley, you’re using Firefox Nightly. Where are you getting it (what distro and package)?

I haven’t looked into the pipewire logs yet in depth. Nothing you’re seeing there looks out of the ordinary or problematic to me.

This is the issue preventing Firefox from building with pipewire support…https://bugzilla.mozilla.org/show_bug.cgi?id=1430775

It is a tricky fix because it has to do with the build tool in use, and its inability to set custom flags. For now, patched releases will have to do.

Have either of you built the changes in xdpw that were merged this morning for session support?

Edit:

And @jameswalmsley, could you provide a more complete backtrace? Maybe run xdpw in gdb and do a bt full after the segfault? I’m hoping to see if there was any additional context as the segfault is occurring pretty deep into the linked pipewire plugin code.

Latest master for me with fedora-firefox-wayland-bin (from aur), using https://mozilla.github.io/webrtc-landing/gum_test.html full screen sharing. Pipewire logs:

[E][000017593.677537][impl-link.c:118 pw_impl_link_update_state()] link 0x55b76d7dcd50: update state negotiating -> error (no more input formats)
[E][000017596.515528][private.h:218 pw_core_resource_errorv()] resource 0x55b76d0d5980: id:0 seq:348 res:-22 (Invalid argument) msg:"unknown resource 64 op:4"
[E][000017596.515607][core.c:71 core_event_error()] core 0x559612a37fc0: proxy 0x559612a37fc0 id:0: seq:348 res:-22 (Invalid argument) msg:"unknown resource 64 op:4"
[E][000017596.515614][media-session.c:1629 core_error()] error id:0 seq:348 res:-22 (Invalid argument): unknown resource 64 op:4

The xdg-portal-wlr doesn’t segfault though (latest master):

2020/04/16 13:03:34 [TRACE] - dbus: start: found matching session /org/freedesktop/portal/desktop/session/1_211/webrtc_session1021323991
2020/04/16 13:03:34 [TRACE] - event-loop: got wayland event
2020/04/16 13:03:34 [TRACE] - wlroots: flags event handler
2020/04/16 13:03:34 [TRACE] - wlroots: damage event handler
2020/04/16 13:03:34 [TRACE] - wlroots: ready event handler
2020/04/16 13:03:34 [TRACE] - wlroots: frame destroyed
2020/04/16 13:03:34 [TRACE] - xdpw: destroying cast instance
2020/04/16 13:03:34 [TRACE] - pipewire: destroying stream
2020/04/16 13:03:34 [INFO] - pipewire: stream state changed to "unconnected"
2020/04/16 13:03:34 [INFO] - pipewire: node id is -1
2020/04/16 13:03:34 [TRACE] - event-loop: got pipewire event
2020/04/16 13:03:34 [TRACE] - event-loop: got pipewire event

Hope that helps.