wl-clipboard icon indicating copy to clipboard operation
wl-clipboard copied to clipboard

`wl-paste --watch ` makes freerdp crash when copy in freerdp

Open milkpuff opened this issue 1 year ago • 7 comments

Problem is: if wl-paste --watch cliphist store runs, copy in freerdp(win10) causes freerdp to crash(stuck). Freerdp use clipboard rediction. if wl-paste --watch cliphist store not runs, copy in freerdp runs normal. I also test replace cliphist store to echo 'test' to exclude cliphist problem. I think that wl-clipboard may have something not works fine with freerdp clipboard rediction.

I submitted issue to freerdp project. Issue link.Freerdp dev said it's may not freerdp's problem. Hope you can check this issue to see more about this.

My environment: OS: Archlinux + hyprland wl-clipboard version: 2.2.1

milkpuff avatar Jul 06 '24 16:07 milkpuff

Hi!

I also test replace cliphist store to echo 'test' to exclude cliphist problem.

And what results did you get, did the issue still reproduce with wl-paste --watch echo test? Did you get continuous test lines being printed once you copied something on the remote machine? What if you do e.g. wl-paste --watch bash -c 'echo test && cliphist store'?

Please attach WAYLAND_DEBUG=1 logs of wl-paste, too.

bugaevc avatar Jul 06 '24 16:07 bugaevc

@bugaevc

wl-paste --watch echo test shows test when I copy in freerdp, and xfreerdp stuck. wl-paste --watch bash -c 'echo test && cliphist store', shows test, but the text I copyed not in cliphist list, and xfreerdp stuck. And WAYLAND_DEBUG=1 wl-paste --watch bash -c 'echo test && cliphist store' log:

[1989417.935] {Default Queue}  -> wl_display#1.get_registry(new id wl_registry#2)
[1989417.945] {Default Queue}  -> wl_display#1.sync(new id wl_callback#3)
[1989418.437] {Display Queue} wl_display#1.delete_id(3)
[1989418.444] {Default Queue} wl_registry#2.global(1, "wl_seat", 9)
[1989418.454] {Default Queue}  -> wl_registry#2.bind(1, "wl_seat", 2, new id [unknown]#4)
[1989418.459] {Default Queue} wl_registry#2.global(2, "wl_data_device_manager", 3)
[1989418.464] {Default Queue}  -> wl_registry#2.bind(2, "wl_data_device_manager", 1, new id [unknown]#5)
[1989418.469] {Default Queue} wl_registry#2.global(3, "wl_compositor", 6)
[1989418.474] {Default Queue}  -> wl_registry#2.bind(3, "wl_compositor", 2, new id [unknown]#6)
[1989418.479] {Default Queue} wl_registry#2.global(4, "wl_subcompositor", 1)
[1989418.484] {Default Queue} wl_registry#2.global(5, "wl_shm", 1)
[1989418.488] {Default Queue}  -> wl_registry#2.bind(5, "wl_shm", 1, new id [unknown]#7)
[1989418.491] {Default Queue} wl_registry#2.global(6, "wp_viewporter", 1)
[1989418.493] {Default Queue} wl_registry#2.global(7, "wp_tearing_control_manager_v1", 1)
[1989418.497] {Default Queue} wl_registry#2.global(8, "wp_fractional_scale_manager_v1", 1)
[1989418.502] {Default Queue} wl_registry#2.global(9, "zxdg_output_manager_v1", 3)
[1989418.506] {Default Queue} wl_registry#2.global(10, "wp_cursor_shape_manager_v1", 1)
[1989418.511] {Default Queue} wl_registry#2.global(11, "zwp_idle_inhibit_manager_v1", 1)
[1989418.516] {Default Queue} wl_registry#2.global(12, "zwp_relative_pointer_manager_v1", 1)
[1989418.520] {Default Queue} wl_registry#2.global(13, "zxdg_decoration_manager_v1", 1)
[1989418.522] {Default Queue} wl_registry#2.global(14, "wp_alpha_modifier_v1", 1)
[1989418.526] {Default Queue} wl_registry#2.global(15, "zwlr_gamma_control_manager_v1", 1)
[1989418.531] {Default Queue} wl_registry#2.global(16, "ext_foreign_toplevel_list_v1", 1)
[1989418.536] {Default Queue} wl_registry#2.global(17, "zwp_pointer_gestures_v1", 3)
[1989418.541] {Default Queue} wl_registry#2.global(18, "zwlr_foreign_toplevel_manager_v1", 3)
[1989418.546] {Default Queue} wl_registry#2.global(19, "zwp_keyboard_shortcuts_inhibit_manager_v1", 1)
[1989418.550] {Default Queue} wl_registry#2.global(20, "zwp_text_input_manager_v3", 1)
[1989418.556] {Default Queue} wl_registry#2.global(21, "zwp_pointer_constraints_v1", 1)
[1989418.560] {Default Queue} wl_registry#2.global(22, "zwlr_output_power_manager_v1", 1)
[1989418.565] {Default Queue} wl_registry#2.global(23, "xdg_activation_v1", 1)
[1989418.569] {Default Queue}  -> wl_registry#2.bind(23, "xdg_activation_v1", 1, new id [unknown]#8)
[1989418.573] {Default Queue} wl_registry#2.global(24, "ext_idle_notifier_v1", 1)
[1989418.577] {Default Queue} wl_registry#2.global(25, "ext_session_lock_manager_v1", 1)
[1989418.581] {Default Queue} wl_registry#2.global(26, "zwp_input_method_manager_v2", 1)
[1989418.586] {Default Queue} wl_registry#2.global(27, "zwp_virtual_keyboard_manager_v1", 1)
[1989418.590] {Default Queue} wl_registry#2.global(28, "zwlr_virtual_pointer_manager_v1", 2)
[1989418.595] {Default Queue} wl_registry#2.global(29, "zwlr_output_manager_v1", 4)
[1989418.600] {Default Queue} wl_registry#2.global(30, "org_kde_kwin_server_decoration_manager", 1)
[1989418.604] {Default Queue} wl_registry#2.global(31, "hyprland_focus_grab_manager_v1", 1)
[1989418.609] {Default Queue} wl_registry#2.global(32, "zwp_tablet_manager_v2", 1)
[1989418.613] {Default Queue} wl_registry#2.global(33, "zwlr_layer_shell_v1", 5)
[1989418.618] {Default Queue} wl_registry#2.global(34, "wp_presentation", 1)
[1989418.624] {Default Queue} wl_registry#2.global(35, "xdg_wm_base", 6)
[1989418.628] {Default Queue}  -> wl_registry#2.bind(35, "xdg_wm_base", 1, new id [unknown]#9)
[1989418.632] {Default Queue} wl_registry#2.global(36, "zwlr_data_control_manager_v1", 2)
[1989418.635] {Default Queue}  -> wl_registry#2.bind(36, "zwlr_data_control_manager_v1", 2, new id [unknown]#10)
[1989418.639] {Default Queue} wl_registry#2.global(37, "zwp_primary_selection_device_manager_v1", 1)
[1989418.644] {Default Queue}  -> wl_registry#2.bind(37, "zwp_primary_selection_device_manager_v1", 1, new id [unknown]#11)
[1989418.649] {Default Queue} wl_registry#2.global(38, "xwayland_shell_v1", 1)
[1989418.654] {Default Queue} wl_registry#2.global(39, "wl_drm", 2)
[1989418.659] {Default Queue} wl_registry#2.global(40, "zwp_linux_dmabuf_v1", 5)
[1989418.664] {Default Queue} wl_registry#2.global(41, "hyprland_toplevel_export_manager_v1", 2)
[1989418.668] {Default Queue} wl_registry#2.global(42, "zwp_text_input_manager_v1", 1)
[1989418.673] {Default Queue} wl_registry#2.global(43, "hyprland_global_shortcuts_manager_v1", 1)
[1989418.678] {Default Queue} wl_registry#2.global(44, "zwlr_screencopy_manager_v1", 3)
[1989418.683] {Default Queue} wl_registry#2.global(45, "wp_drm_lease_device_v1", 1)
[1989418.688] {Default Queue} wl_registry#2.global(46, "wl_output", 4)
[1989418.693] {Default Queue} wl_callback#3.done(149378)
[1989418.698] {Default Queue}  -> wl_display#1.sync(new id wl_callback#3)
[1989418.802] {Display Queue} wl_display#1.delete_id(3)
[1989418.806] {Default Queue} wl_seat#4.name("Hyprland")
[1989418.811] {Default Queue} wl_seat#4.capabilities(3)
[1989418.814] {Default Queue} discarded wl_shm#7.format(0)
[1989418.818] {Default Queue} discarded wl_shm#7.format(1)
[1989418.821] {Default Queue} discarded wl_shm#7.format(875709016)
[1989418.824] {Default Queue} discarded wl_shm#7.format(875708993)
[1989418.827] {Default Queue} discarded wl_shm#7.format(875710274)
[1989418.829] {Default Queue} discarded wl_shm#7.format(842094674)
[1989418.832] {Default Queue} discarded wl_shm#7.format(842088786)
[1989418.835] {Default Queue} discarded wl_shm#7.format(892426322)
[1989418.838] {Default Queue} discarded wl_shm#7.format(892420434)
[1989418.841] {Default Queue} discarded wl_shm#7.format(909199186)
[1989418.843] {Default Queue} discarded wl_shm#7.format(808665688)
[1989418.845] {Default Queue} discarded wl_shm#7.format(808665665)
[1989418.847] {Default Queue} discarded wl_shm#7.format(1211384408)
[1989418.849] {Default Queue} discarded wl_shm#7.format(1211384385)
[1989418.851] {Default Queue} discarded wl_shm#7.format(942948952)
[1989418.854] {Default Queue} discarded wl_shm#7.format(942948929)
[1989418.856] {Default Queue} wl_callback#3.done(149378)
[1989418.861] {Default Queue}  -> zwlr_data_control_manager_v1#10.get_data_device(new id zwlr_data_control_device_v1#3, wl_seat#4)
[1989418.931] {Default Queue} zwlr_data_control_device_v1#3.data_offer(new id zwlr_data_control_offer_v1#4278190080)
[1989418.934] {Default Queue} zwlr_data_control_offer_v1#4278190080.offer("text/plain")
[1989418.938] {Default Queue} zwlr_data_control_offer_v1#4278190080.offer("text/plain")
[1989418.942] {Default Queue} zwlr_data_control_offer_v1#4278190080.offer("text/plain;charset=utf-8")
[1989418.944] {Default Queue} zwlr_data_control_offer_v1#4278190080.offer("TEXT")
[1989418.947] {Default Queue} zwlr_data_control_offer_v1#4278190080.offer("STRING")
[1989418.951] {Default Queue} zwlr_data_control_offer_v1#4278190080.offer("UTF8_STRING")
[1989418.954] {Default Queue} zwlr_data_control_device_v1#3.selection(zwlr_data_control_offer_v1#4278190080)
[1989418.967] {Default Queue}  -> zwlr_data_control_offer_v1#4278190080.receive("text/plain;charset=utf-8", fd 6)
test
[1989430.293] {Default Queue}  -> zwlr_data_control_offer_v1#4278190080.destroy()
[1989430.306] {Default Queue} zwlr_data_control_device_v1#3.data_offer(new id zwlr_data_control_offer_v1#4278190081)
[1989430.311] {Default Queue} zwlr_data_control_offer_v1#4278190081.offer("text/html")
[1989430.314] {Default Queue} zwlr_data_control_offer_v1#4278190081.offer("text/_moz_htmlcontext")
[1989430.316] {Default Queue} zwlr_data_control_offer_v1#4278190081.offer("text/_moz_htmlinfo")
[1989430.319] {Default Queue} zwlr_data_control_offer_v1#4278190081.offer("text/plain;charset=utf-8")
[1989430.322] {Default Queue} zwlr_data_control_offer_v1#4278190081.offer("UTF8_STRING")
[1989430.324] {Default Queue} zwlr_data_control_offer_v1#4278190081.offer("COMPOUND_TEXT")
[1989430.327] {Default Queue} zwlr_data_control_offer_v1#4278190081.offer("TEXT")
[1989430.330] {Default Queue} zwlr_data_control_offer_v1#4278190081.offer("text/plain")
[1989430.333] {Default Queue} zwlr_data_control_offer_v1#4278190081.offer("STRING")
[1989430.335] {Default Queue} zwlr_data_control_offer_v1#4278190081.offer("text/plain;charset=utf-8")
[1989430.337] {Default Queue} zwlr_data_control_offer_v1#4278190081.offer("text/plain")
[1989430.340] {Default Queue} zwlr_data_control_offer_v1#4278190081.offer("text/x-moz-url-priv")
[1989430.343] {Default Queue} zwlr_data_control_device_v1#3.primary_selection(zwlr_data_control_offer_v1#4278190081)
[1989430.346] {Default Queue}  -> zwlr_data_control_offer_v1#4278190081.destroy()
[2035729.604] {Default Queue} zwlr_data_control_device_v1#3.data_offer(new id zwlr_data_control_offer_v1#4278190081)
[2035729.622] {Default Queue} zwlr_data_control_offer_v1#4278190081.offer("text/plain;charset=utf-8")
[2035729.627] {Default Queue} zwlr_data_control_offer_v1#4278190081.offer("STRING")
[2035729.630] {Default Queue} zwlr_data_control_device_v1#3.selection(zwlr_data_control_offer_v1#4278190081)
[2035729.644] {Default Queue}  -> zwlr_data_control_offer_v1#4278190081.receive("text/plain;charset=utf-8", fd 6)
test

In log, the first 'test' shows when command runs; the second 'test' shows when copy in xfreerdp, then xfreerdp stucks.

milkpuff avatar Jul 06 '24 17:07 milkpuff

Thanks. From the log, it looks like wl-clipboard is doing everything correctly, and there's no feedback loop going on, xfreerdp (or X11, or Hyprland) just get stuck somewhere along the way.

Does the same happen if you don't have wl-paste --watch running, copy something in xfreerdp, then run wl-paste (without --watch)? What if instead of wl-paste, you just paste into some other Wayland-native application (e.g. a text editor)?

bugaevc avatar Jul 06 '24 17:07 bugaevc

Don't run wl-paste --watch, copy in xfreerdp runs normally. And paste to local app runs normally. They all works fine.

milkpuff avatar Jul 06 '24 17:07 milkpuff

So which step do you think went wrong? Which project should I submit an issue to? @bugaevc

milkpuff avatar Jul 07 '24 03:07 milkpuff

I test copyq. It has the same problem.

milkpuff avatar Jul 07 '24 05:07 milkpuff

Which project should I submit an issue to?

Given that wl-clipboard seems to be doing everything properly, and that using copyq tiggers the same issue, I'd say the issue is either in how Hyprland implements Xwayland ⟷ Wayland clipboard synchronization, or somewhere in xfreerdp.

That being said, what wl-paste --watch does, from the Wayland perspective, is not that different from regular wl-paste, so it's unclear why one triggers the issue and the other does not. It might be that wl-paste --watch tries to paste immediately when the a selection appears (when you copy on the remote machine) rather than some short time later — perhaps there's a race condition somewhere?

bugaevc avatar Jul 07 '24 08:07 bugaevc