r-c-f/waynergy

xkb config makes waynergy crash with: wl_display@1 no memory

Opened this issue · 4 comments

Bykow commented

Hello !

I've had an issue since this morning. No clue what it means, I tried to document all I could find.

  • waynergy version 0.0.15
  • sway version 1.8
  • Server is MacOS running Synergy 1.8

Logs:

```Feb 06 08:57:21 factarr systemd[1496]: Started Waynergy Client for Wayland.
Feb 06 08:57:21 factarr waynergy[11150]: 0.000002735: [INFO] Log initialized at level 3
Feb 06 08:57:21 factarr waynergy[11150]: 0.000012975: [INFO] waynergy version 0.0.15
Feb 06 08:57:21 factarr waynergy[11150]: 0.000016331: [INFO] Using manual dimensions: 2560x1440
Feb 06 08:57:21 factarr waynergy[11150]: 0.010643786: [WARN] Child died: PID 11153, Status 1
Feb 06 08:57:21 factarr waynergy[11150]: 0.010660577: [WARN] Could not kill lingering wlpaste instances: -1
Feb 06 08:57:21 factarr waynergy[11150]: 0.011128455: [INFO] Not using preferred mode on output -- check config
Feb 06 08:57:21 factarr waynergy[11150]: 0.011147310: [INFO] Output updated: 2560x1440 at 0, 0 (scale: 1)
Feb 06 08:57:21 factarr waynergy[11150]: 0.011158561: [INFO] Output name: DP-1
Feb 06 08:57:21 factarr waynergy[11150]: 0.011165194: [INFO] Output description: Dell Inc. Dell S2716DG #ASOGK8FE1NHd (DP-1)
Feb 06 08:57:21 factarr waynergy[11150]: 0.011171395: [INFO] Output updated: 2560x1440 at 1280, 0 (scale: 1)
Feb 06 08:57:21 factarr waynergy[11150]: 0.011304244: [INFO] Compositor seems to be sway
Feb 06 08:57:21 factarr waynergy[11150]: 0.016752029: [INFO] Sway version is 1.8
Feb 06 08:57:21 factarr waynergy[11150]: 0.016796732: [INFO] Using wlroots virtual input protocols
Feb 06 08:57:21 factarr waynergy[11150]: 0.016804437: [INFO] Using wlroots protocols for virtual input
Feb 06 08:57:21 factarr waynergy[11150]: 0.019437574: [INFO] Using KDE idle inhibition protocol
Feb 06 08:57:21 factarr waynergy[11150]: 0.019459645: [INFO] Going to connect to 10.67.99.133 at port 24800
Feb 06 08:57:21 factarr waynergy[11150]: 0.020820446: [INFO] Server is Synergy 1.8
Feb 06 08:57:21 factarr waynergy[11150]: 0.020855482: [INFO] Connected as client "factarr"
Feb 06 08:57:21 factarr waynergy[11150]: 0.022299650: [ERROR] wl_display@1: error 2: no memory
Feb 06 08:57:21 factarr waynergy[11150]: 0.022329425: [ERROR] Logged wayland errors set to fatal
Feb 06 08:57:21 factarr waynergy[11150]: 0.022348070: [ERROR] wl_display_flush_base: No wayland display error, but flush failed: Broken pipe
Feb 06 08:57:21 factarr systemd-coredump[11160]: [🡕] Process 11150 (waynergy) of user 1000 dumped core.

                                                 Stack trace of thread 11150:
                                                 #0  0x00007f0432e65117 n/a (libwayland-client.so.0 + 0x6117)
                                                 #1  0x00007f0432e651f5 n/a (libwayland-client.so.0 + 0x61f5)
                                                 #2  0x00007f0432e69ae2 wl_proxy_marshal_flags (libwayland-client.so.0 + 0xaae2)
                                                 #3  0x0000564275ebad28 n/a (waynergy + 0xed28)
                                                 #4  0x0000564275eba7eb n/a (waynergy + 0xe7eb)
                                                 #5  0x0000564275eba848 n/a (waynergy + 0xe848)
                                                 #6  0x0000564275eba95a n/a (waynergy + 0xe95a)
                                                 #7  0x0000564275ebaa93 n/a (waynergy + 0xea93)
                                                 #8  0x0000564275ebab4d n/a (waynergy + 0xeb4d)
                                                 #9  0x0000564275ebad31 n/a (waynergy + 0xed31)
                                                 #10 0x0000564275eba7eb n/a (waynergy + 0xe7eb)
                                                 #11 0x0000564275eba848 n/a (waynergy + 0xe848)
                                                 #12 0x0000564275eba95a n/a (waynergy + 0xe95a)
                                                 #13 0x0000564275eba9d3 n/a (waynergy + 0xe9d3)
                                                 #14 0x00007f0432e6545a n/a (libwayland-client.so.0 + 0x645a)
                                                 #15 0x00007f0432e659bb n/a (libwayland-client.so.0 + 0x69bb)
                                                 #16 0x00007f0432b8b4f6 n/a (libffi.so.8 + 0x74f6)
                                                 #17 0x00007f0432b87f5e n/a (libffi.so.8 + 0x3f5e)
                                                 #18 0x00007f0432b8ab73 ffi_call (libffi.so.8 + 0x6b73)
                                                 #19 0x00007f0432e66645 n/a (libwayland-client.so.0 + 0x7645)
                                                 #20 0x00007f0432e66e03 n/a (libwayland-client.so.0 + 0x7e03)
                                                 #21 0x00007f0432e66fcf wl_display_dispatch_queue_pending (libwayland-client.so.0 + 0x7fcf)
                                                 #22 0x0000564275eb2849 n/a (waynergy + 0x6849)
                                                 #23 0x00007f0432c54290 n/a (libc.so.6 + 0x23290)
                                                 #24 0x00007f0432c5434a __libc_start_main (libc.so.6 + 0x2334a)
                                                 #25 0x0000564275eb2885 n/a (waynergy + 0x6885)
                                                 ELF object binary architecture: AMD x86-64
Feb 06 08:57:21 factarr systemd[1496]: waynergy.service: Main process exited, code=dumped, status=11/SEGV
Feb 06 08:57:21 factarr systemd[1496]: waynergy.service: Failed with result 'core-dump'.
Feb 06 08:57:22 factarr systemd[1496]: waynergy.service: Scheduled restart job, restart counter is at 2.
Feb 06 08:57:22 factarr systemd[1496]: Stopped Waynergy Client for Wayland.
Bykow commented

Further info:
The issue seem to be related to xkb config. When disabling the offset (set as 7 for macos) the client can connect but keymaps are all over the place.

Logs are unchanged from previous post.

$ cat .xkb/keycodes/mac
// ~/.xkb/keycodes/mac
//Set waynergy config `xkb_key_offset` to 7

default xkb_keycodes "mac" {
	minimum  = 8;
	maximum  = 255;
	<ESC>  = 61;
	<FK01>  = 130;
	<FK02>  = 128;
	<FK03>  = 107;
	<FK04>  = 126;
	<FK05>  = 104;
	<FK06>  = 105;
	<FK07>  = 106;
	<FK08>  = 108;
	<FK09>  = 109;
	<FK10>  = 117;
	<FK11>  = 111;
	<FK12>  = 119;
	<TLDE>  = 58;
	<AE01>  = 26;
	<AE02>  = 27;
	<AE03>  = 28;
	<AE04>  = 29;
	<AE05>  = 31;
	<AE06>  = 30;
	<AE07>  = 34;
	<AE08>  = 36;
	<AE09>  = 33;
	<AE10>  = 37;
	<AE11>  = 35;
	<AE12>  = 32;
	<BKSP>  = 59;
	<TAB>  = 56;
	<AD01>  = 20;
	<AD02>  = 21;
	<AD03>  = 22;
	<AD04>  = 23;
	<AD05>  = 25;
	<AD06>  = 24;
	<AD07>  = 40;
	<AD08>  = 42;
	<AD09>  = 39;
	<AD10>  = 43;
	<AD11>  = 41;
	<AD12>  = 38;
	<BKSL>  = 50;
	<CAPS>  = 65;
	<AC01>  = 8;
	<AC02>  = 9;
	<AC03>  = 10;
	<AC04>  = 11;
	<AC05>  = 13;
	<AC06>  = 12;
	<AC07>  = 46;
	<AC08>  = 48;
	<AC09>  = 45;
	<AC10>  = 49;
	<AC11>  = 47;
	<RTRN>  = 44;
	<LFSH>  = 64;
	<AB01>  = 14;
	<AB02>  = 15;
	<AB03>  = 16;
	<AB04>  = 17;
	<AB05>  = 19;
	<AB06>  = 53;
	<AB07>  = 54;
	<AB08>  = 51;
	<AB09>  = 55;
	<AB10>  = 52;
	<LALT>  = 66;
	<LCTL>  = 67;
	<SPCE>  = 57;
	<LWIN>  = 63;
	<UP>  = 134;
	<LEFT>  = 131;
	<DOWN>  = 133;
	<RGHT>  = 132;
};
$ cat .config/waynergy/config.ini
host = 10.67.99.133
#port = 28400
name = factarr
width = 2560
height = 1440
xkb_key_offset = 7
# Restart on a fatal error, rather than exit
# restart_on_fatal = false

[screensaver]
start = pkill -SIGUSR1 swayidle
; stop = pkill swaylock

[idle-inhibit]
method = key
keyname = HYPR

[tls]
enable = false
tofu = false

[log]
level = 3
mode = a
path = /tmp/waynergy.log

[wayland]
# Timeout for display flushes (in ms), negative to block indefinitely
#flush_timeout = 5000

[wlr]
wheel_mult = 1
$ cat .config/waynergy/xkb_keymap
xkb_keymap {
	xkb_keycodes  { include "mac+aliases(qwerty)"	};
	xkb_types     { include "complete"	};
	xkb_compat    { include "complete"	};
	xkb_symbols   { include "pc+us+inet(evdev)"	};
	xkb_geometry  { include "pc(pc105)"	};
};
r-c-f commented

Sorry for the lack of an initial response (this seemed to slip through the email cracks as it were)

I'll definitely be having a go at reproducing this. The error is ultimately coming from the compositor side so I'll need to trace it in sway itself, though dumping core after registering the error indicates a clear failure on the waynergy side as well.

r-c-f commented

Looking at sway's debug logging, this is due to xkbcommon 1.5's restrictions on user configuration for even slightly-privileged processes. swaywm/sway#7326 fixes this.

r-c-f commented

c4c0d94 resolves the core dumping bit, at the very least.

As a workaround until the sway commit ends up in release, compile the keymap fully using xkbcomp (which can be told to respect includes); from within ~/.config/waynergy:

mv xkb_keymap xkb_keymap.orig
xkbcomp -I$HOME/.xkb -xkb xkb_keymp.orig xkb_keymap