Bug 458636 - krfb-virtualmonitor crashes in Wayland with default or no config (~/.config/krfbrc)
Summary: krfb-virtualmonitor crashes in Wayland with default or no config (~/.config/k...
Status: RESOLVED FIXED
Alias: None
Product: krfb
Classification: Applications
Component: general (other bugs)
Version First Reported In: 22.08.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: George Goldberg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-02 11:07 UTC by Yaroslav Sidlovsky
Modified: 2024-04-29 16:50 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 23.04.3
Sentry Crash Report:


Attachments
GDB backtrace (2.58 KB, text/x-log)
2022-09-02 11:07 UTC, Yaroslav Sidlovsky
Details
Archlinux - GDB output from jiriks74 (9.84 KB, text/plain)
2024-01-17 18:55 UTC, jiri.stefka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yaroslav Sidlovsky 2022-09-02 11:07:46 UTC
Created attachment 151780 [details]
GDB backtrace

SUMMARY
I've trying to start `krfb-virtualmonitor` in Plasma Wayland session with this command:
```
krfb-virtualmonitor --name wireless --password 123 --resolution 1280x720 --port 5900
```
Every time it crashes with SIGSEGV (Address boundary error).

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 36
KDE Plasma Version: 5.25.4
KDE Frameworks Version: 5.97.0
Qt Version: 5.15.5
Kernel Version: 5.19.4-200.fc36.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 5700X 8-Core Processor
Memory: 31.2 ГиБ of RAM
Graphics Processor: NVIDIA GeForce GTX 1060 6GB/PCIe/SSE2
Manufacturer: ASUS
Comment 1 Yaroslav Sidlovsky 2022-09-02 11:10:52 UTC
Additional output from gdb:
```
(gdb) frame 1
#1  0x00007fffe1b141ff in KrfbXCBEventFilter::KrfbXCBEventFilter (owner=0x5555556b1ed0, this=0x5555556b1fc0) at /usr/src/debug/krfb-22.08.0-2.fc36.x86_64/framebuffers/xcb/xcb_framebuffer.cpp:52
52          const xcb_query_extension_reply_t *xdamage_data = xcb_get_extension_data(
(gdb) list
47      KrfbXCBEventFilter::KrfbXCBEventFilter(XCBFrameBuffer *owner):
48          xdamageBaseEvent(0), xdamageBaseError(0),
49          xshmBaseEvent(0), xshmBaseError(0), xshmAvail(false),
50          fb_owner(owner)
51      {
52          const xcb_query_extension_reply_t *xdamage_data = xcb_get_extension_data(
53                      QX11Info::connection(), &xcb_damage_id);
54          if (xdamage_data) {
55              // also query extension version!
56              // ATTENTION: if we don't do that, xcb_damage_create() will always FAIL!
(gdb) p QX11Info::connection()
$1 = (xcb_connection_t *) 0x0
```

Why QX11Info::connection() is called in Wayland session, is it OK?
Comment 2 Yaroslav Sidlovsky 2022-09-02 11:16:49 UTC
Output from `QT_LOGGING_RULES="krfb.krfb=true" krfb-virtualmonitor --name wireless --password 123 --resolution 1280x720 --port 5900`:
```
krfb.krfb: Loaded plugin with name  "pw"
krfb.krfb: Loaded plugin with name  "qt"
krfb.krfb: Loaded plugin with name  "xcb"
krfb.krfb: Using FrameBuffer: "xcb"
fish: Job 1, 'QT_LOGGING_RULES="krfb.krfb=tru…' terminated by signal SIGSEGV (Address boundary error
```
Comment 3 Yaroslav Sidlovsky 2022-09-02 12:41:39 UTC
TLDR:
Default framebuffer plugin was set to xcb, if  krfb-virtualmonitor uses it under Wayland - it will crash.
Crash could be simply reproduced with: `rm -f ~/.config/krfbrc && krfb-virtualmonitor --name wireless --password 123 --resolution 2340x1080 --port 5900`.
Comment 4 Victor Yevitchenko 2022-11-29 16:47:35 UTC
Confirm issue.
krfb 22.11.90
OS: Kubuntu 22.10
KDE Plasma: 5.25.5
KDE Frameworks: 5.98.0
Qt: 5.15.6
Kernel version: 5.19.0-23-generic (64-бита)
Graphics Platform: Wayland
CPU: 12 × AMD Ryzen 5 5500U with Radeon Graphics
RAM: 30,7 ГиБ ОЗУ
Manufacturer: HP
Comment 5 Yaroslav Sidlovsky 2023-08-08 13:26:49 UTC
Looks like this bug is gone.
It's still crashing after connect but with different stack trace.
Comment 6 jiri.stefka 2024-01-17 18:55:01 UTC
Created attachment 164989 [details]
Archlinux - GDB output from jiriks74
Comment 7 jiri.stefka 2024-01-17 19:03:35 UTC
I've encountered this bug when I tried to use the KDE Connect's Virtual Display feature.

I've ran `krfb` in GDB to see what causes the problem but I'm no smarter from the output. The GDB output is in attachments: https://bugs.kde.org/attachment.cgi?id=164989

The line that it gets SIGSEGV on is this one: 

#0  __memcpy_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:660

I've tried changing the framebuffer module from `pw` to `qt` (as in settings it said that it's a slower fallback module but more stable) but then I saw that it doesn't work on Wayland in the output on `krfb` startup.

OS Info:
Operating System: EndeavourOS (Arch Linux)
KDE Plasma Version: 5.27.10
KDE Frameworks Version: 5.114.0
Qt Version: 5.15.12
Kernel Version: 6.7.0-zen3-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 20 × 12th Gen Intel® Core™ i7-12700H
Memory: 15,3 GiB of RAM
Graphics Processor: Mesa Intel® Graphics
Comment 8 Antti Savolainen 2024-03-30 13:31:54 UTC
Can you retest this issue? There's been changes and as of 6.0.3 I can no longer cause krfb-virtualmonitor to crash nor can I use it to crash plasmashell.
Comment 9 Antti Savolainen 2024-04-20 05:57:22 UTC
Changing status to be more appropriate
Comment 10 Yaroslav Sidlovsky 2024-04-20 08:40:17 UTC
Can't reproduce anymore with krfb-virtualmonitor version 24.02.1, Fedora 40.
Comment 11 jiri.stefka 2024-04-24 14:12:01 UTC
I just tested this on NixOS `krfb-virtualmonitor` doesn't crash (I didn't check if it works) but `kfrb` does. 
krfb-virtualmonitor was ran as `krfb-virtualmonitor --name wireless --password 123 --resolution 1920x1200 --port 5900`

When running  `krfb 23.08.5` as `kfrb` I get:

> Wayland: Detected invalid configuration: preferredFrameBufferPlugin is not pipewire:  "xcb"
> Initializing D-Bus connectivity with XDG Desktop Portal
> DBus session created:  "/org/freedesktop/portal/desktop/request/1_143/krfb2891703386"
> kpipewire_dmabuf_logging: eglChooseConfig returned this many configs: 1
> Segmentation fault (core dumped)
Comment 12 Yaroslav Sidlovsky 2024-04-24 14:19:54 UTC
Try to reset (delete) krfb config & try again.
Comment 13 jiri.stefka 2024-04-29 16:50:57 UTC
(In reply to Yaroslav Sidlovsky from comment #12)
> Try to reset (delete) krfb config & try again.

Tried that already.