xpra icon indicating copy to clipboard operation
xpra copied to clipboard

Weird args re-connection issue: `too many arguments to choose a display`

Open stdedos opened this issue 1 year ago • 7 comments

Describe the bug

2024-01-31 22:19:27,742 server is OK again
2024-01-31 22:19:30,462 Connection lost
2024-01-31 22:19:30,476 remote SSH stderr:
2024-01-31 22:19:30,476  Entering daemon mode; any further errors will be reported to:
2024-01-31 22:19:30,477    '/run/user/1000/xpra/1/server.log'
CONNECTION_LOST, reconnecting

"was: Xpra-x86_64_6.0-r35043\xpra_cmd" shadow ssh://user@ip/1 --ssh="plink -ssh -agent" --modal-windows=no --headerbar=off --source-start=gnome-keyring-daemon --title="@title@ on @@/@server-display@" --encodings=-webp --start="nohup systemd-inhibit --what=handle-lid-switch sleep 1d >/dev/null 2>&1 & inhibit_pid=\$! ; xpra xwait ; kill -9 \$inhibit_pid ; nohup systemd-inhibit --what=handle-lid-switch sleep 5m >/dev/null 2>&1 &" --microphone=off --speaker=off --webcam=no --pulseaudio=no --opengl=no --min-speed=70 --key-shortcut=Shift+F2:toggle_pointer_grab

Press any key to continue . . .
2024-01-31 22:19:31,467 Xpra GTK3 client version 6.0-r35043 (g48292788a) beta
2024-01-31 22:19:31,479  running on Microsoft Windows
2024-01-31 22:19:31,479  cpython 3.11
2024-01-31 22:19:31,955 GStreamer version 1.22.9
2024-01-31 22:19:31,965 created named pipe 'Xpra\4476'
2024-01-31 22:19:32,153 Error setting up the pipeline:
2024-01-31 22:19:32,154  gst_parse_error: could not link decoder to sink (3)
2024-01-31 22:19:32,155  GStreamer pipeline for:
2024-01-31 22:19:32,155   appsrc name=src emit-signals=1 block=0 is-live=1 do-timestamp=1 stream-type=0 format=2 caps=video/x-h264,width=128,height=128,profile=(string)main,stream-format=(string)byte-stream,alignment=(string)au ! \
2024-01-31 22:19:32,156   d3d11h264dec name=decoder ! \
2024-01-31 22:19:32,156   appsink name=sink emit-signals=1 max-buffers=10 drop=False sync=False async=True qos=False caps=video/x-raw,width=128,height=128,format=(string)I420
2024-01-31 22:19:32,156 Error creating context h264 128x128 YUV420P
2024-01-31 22:19:32,157 gstreamer: h264 decoding failed: failed to setup gstreamer pipeline
2024-01-31 22:19:32,162 keyboard layout 'United States - English' : 'us' (0x409)
2024-01-31 22:19:32,174 xpra initialization error:
 too many arguments to choose a display (3): ['ssh://user@ip/1', 'on', '@@/@server-display@']

To Reproduce Steps to reproduce the behavior:

  1. server command
  2. client command
  3. specific action to trigger the bug

System Information (please complete the following information):

  • Server OS: Ubuntu 20.04.6 LTS
  • Client OS: Microsoft Windows [Version 10.0.18363.836]
  • Xpra Server Version: (see above)
  • Xpra Client Version: (see above)

Additional context

Server side logs: https://github.com/Xpra-org/xpra/issues/4114

Relates to https://github.com/Xpra-org/xpra/issues/4026?

stdedos avatar Jan 31 '24 20:01 stdedos

--pulseaudio=no

This doesn't do anything for shadow servers.

--opengl=no

Any particular reason?

Press any key to continue . . .

I have no idea where this is coming from.

... --title="@title@ on @@/@server-display@" ... ... too many arguments to choose a display (3): ['ssh://user@ip/1', 'on', '@@/@server-display@']

Looks like the arguments are being parsed incorrectly and the space in the title string is causing the problems. I don't understand why that is because we preserve the command line that the executable is run with: https://github.com/Xpra-org/xpra/blob/ffb5abfce7217b49ddd8045e4e83275c34c136c4/xpra/scripts/main.py#L88 Then eventually (via run_mode and run_client), we re-use it: https://github.com/Xpra-org/xpra/blob/ffb5abfce7217b49ddd8045e4e83275c34c136c4/xpra/scripts/main.py#L1334-L1335

I will have to do some testing.

totaam avatar Feb 01 '24 05:02 totaam

--pulseaudio=no

This doesn't do anything for shadow servers.

Bad DRY-ness for my xpra scripts 😅

--opengl=no

Any particular reason?

"Safest/Known last working" configuration. I promise to get rid of it when when everything else works 🙏

Any particular reason?

Press any key to continue . . .

That's mine, ignore it

Before the (.bat) script kills itself, I run pause. Just in case I need the client logs 😅

... --title="@title@ on @@/@server-display@" ... ... too many arguments to choose a display (3): ['ssh://user@ip/1', 'on', '@@/@server-display@']

Looks like the arguments are being parsed incorrectly and the space in the title string is causing the problems.

I'm adding arguments in the form

set "args=!args! --title="@title@ on @@/@server-display@""

But Windows bat files are notoriously hard to get right. I have no other alternative for a scripting language, though 😓

stdedos avatar Feb 01 '24 05:02 stdedos

I'm not going to spend time on this unless you can give me a command line that I can reproduce it with. I've just tried with that one, and it worked for me. I strongly suspect that the BAT file args are to blame.

totaam avatar Feb 01 '24 15:02 totaam

Lucky me, the new version does actually cause something more visible:

"Xpra-x86_64_6.0-r35164\xpra_cmd" shadow ssh://user@ip/1 --ssh="plink -ssh -agent" --modal-windows=no --headerbar=off --title="@title@ on @@/@server-display@" --encodings=-webp --start="nohup systemd-inhibit --what=handle-lid-switch sleep 1d >/dev/null 2>&1 & inhibit_pid=\$! ; xpra xwait ; kill -9 \$inhibit_pid ; nohup systemd-inhibit --what=handle-lid-switch sleep 5m >/dev/null 2>&1 &" --microphone=off --speaker=off --webcam=no --pulseaudio=no --opengl=no --min-speed=70 --key-shortcut=Shift+F2:toggle_pointer_grab

XPRA_EXECUTABLE=Xpra-x86_64_6.0-r35164


2024-02-22 23:43:23,466 Xpra GTK3 client version 6.0-r35164 (g4993839d1) beta
2024-02-22 23:43:23,476  running on Microsoft Windows
2024-02-22 23:43:23,476  cpython 3.11

...

2024-02-22 23:43:28,787 remote SSH stderr:
2024-02-22 23:43:28,815  no display specified
2024-02-22 23:43:28,819  bash: line 0: kill: $inhibit_pid: arguments must be process or job IDs
2024-02-22 23:43:28,820  no display specified
2024-02-22 23:43:28,821  bash: line 0: kill: $inhibit_pid: arguments must be process or job IDs
2024-02-22 23:43:28,821  no display specified
2024-02-22 23:43:28,822  bash: line 0: kill: $inhibit_pid: arguments must be process or job IDs
2024-02-22 23:43:28,823  no display specified
2024-02-22 23:43:28,823  bash: line 0: kill: $inhibit_pid: arguments must be process or job IDs
2024-02-22 23:43:28,824  no display specified
2024-02-22 23:43:28,827 Error: failed to receive anything, not an xpra server?
2024-02-22 23:43:28,828   could also be the wrong protocol, username, password or port
2024-02-22 23:43:28,829   or the session was not found
2024-02-22 23:43:28,829 Connection failed

Any chance I can stop+see the script?

stdedos avatar Feb 22 '24 21:02 stdedos

-d ssh will show you all the girl details of script invocation.

totaam avatar Feb 23 '24 02:02 totaam

Bump?

totaam avatar Mar 20 '24 12:03 totaam

There seems to be some discrepancy in parsing:

The "funny command" is:

set "args=!args! --start="nohup systemd-inhibit --what=handle-lid-switch sleep 1d ^>/dev/null 2^>^&1 ^& inhibit_pid=\$^^! ; xpra xwait ; kill -9 \$inhibit_pid ; nohup systemd-inhibit --what=handle-lid-switch sleep 5m ^>/dev/null 2^>^&1 ^&""

if sent like this, server receives:

if command -v "xpra" > /dev/null 2>&1; then xpra _proxy_shadow_start ":1" "--opengl=no" "--title=@title@ on @@/@server-display@" "--ssh=plink -ssh -agent" "--debug=ssh" "--microphone=off" "--speaker=off" "--webcam=no" "--headerbar=off" "--min-speed=70" "--pulseaudio=no" "--modal-windows=no" "--encodings=h264,vp9,vp8,mpeg4,mpeg4+mp4,h264+mp4,vp8+webm,vp9+webm,png,png/P,png/L,avif,rgb,rgb24,rgb32,jpeg,jpega,h265,av1,scroll,grayscale,stream" "--key-shortcut=Control+Menu:toggle_keyboard_grab" "--key-shortcut=Shift+Menu:toggle_pointer_grab" "--key-shortcut=Shift+F11:toggle_fullscreen" "--key-shortcut=#+F1:show_menu" "--key-shortcut=#+F2:show_start_new_command" "--key-shortcut=#+F3:show_bug_report" "--key-shortcut=#+F4:quit" "--key-shortcut=#+F5:show_window_info" "--key-shortcut=#+F6:show_shortcuts" "--key-shortcut=#+F7:show_docs" "--key-shortcut=#+F8:toggle_keyboard_grab" "--key-shortcut=#+F9:toggle_pointer_grab" "--key-shortcut=#+F10:magic_key" "--key-shortcut=#+F11:show_session_info" "--key-shortcut=#+F12:toggle_debug" "--key-shortcut=#+plus:scaleup" "--key-shortcut=#+minus:scaledown" "--key-shortcut=#+underscore:scaledown" "--key-shortcut=#+KP_Add:scaleup" "--key-shortcut=#+KP_Subtract:scaledown" "--key-shortcut=#+KP_Multiply:scalereset" "--key-shortcut=#+bar:scalereset" "--key-shortcut=#+question:scalingoff" "--key-shortcut=Shift+F2:toggle_pointer_grab" "--start=nohup systemd-inhibit --what=handle-lid-switch sleep 1d >/dev/null 2>&1 & inhibit_pid=\\$! ; xpra xwait ; kill -9 \\$inhibit_pid ; nohup systemd-inhibit --what=handle-lid-switch sleep 5m >/dev/null 2>&1 &";elif [ -x $

However, if we send

set "args=!args! --start="nohup systemd-inhibit --what=handle-lid-switch sleep 1d ^>/dev/null 2^>^&1 ^& inhibit_pid=$^^! ; xpra xwait ; kill -9 $inhibit_pid ; nohup systemd-inhibit --what=handle-lid-switch sleep 5m ^>/dev/null 2^>^&1 ^&""

(i.e., without \$), we receive

if command -v "xpra" > /dev/null 2>&1; then xpra _proxy_shadow_start ":1" "--opengl=no" "--title=@title@ on @@/@server-display@" "--ssh=plink -ssh -agent" "--debug=ssh" "--microphone=off" "--speaker=off" "--webcam=no" "--headerbar=off" "--min-speed=70" "--pulseaudio=no" "--modal-windows=no" "--encodings=h264,vp9,vp8,mpeg4,mpeg4+mp4,h264+mp4,vp8+webm,vp9+webm,png,png/P,png/L,avif,rgb,rgb24,rgb32,jpeg,jpega,h265,av1,scroll,grayscale,stream" "--key-shortcut=Control+Menu:toggle_keyboard_grab" "--key-shortcut=Shift+Menu:toggle_pointer_grab" "--key-shortcut=Shift+F11:toggle_fullscreen" "--key-shortcut=#+F1:show_menu" "--key-shortcut=#+F2:show_start_new_command" "--key-shortcut=#+F3:show_bug_report" "--key-shortcut=#+F4:quit" "--key-shortcut=#+F5:show_window_info" "--key-shortcut=#+F6:show_shortcuts" "--key-shortcut=#+F7:show_docs" "--key-shortcut=#+F8:toggle_keyboard_grab" "--key-shortcut=#+F9:toggle_pointer_grab" "--key-shortcut=#+F10:magic_key" "--key-shortcut=#+F11:show_session_info" "--key-shortcut=#+F12:toggle_debug" "--key-shortcut=#+plus:scaleup" "--key-shortcut=#+minus:scaledown" "--key-shortcut=#+underscore:scaledown" "--key-shortcut=#+KP_Add:scaleup" "--key-shortcut=#+KP_Subtract:scaledown" "--key-shortcut=#+KP_Multiply:scalereset" "--key-shortcut=#+bar:scalereset" "--key-shortcut=#+question:scalingoff" "--key-shortcut=Shift+F2:toggle_pointer_grab" "--start=nohup systemd-inhibit --what=handle-lid-switch sleep 1d >/dev/null 2>&1 & inhibit_pid=\\$! ; xpra xwait ; kill -9 \\$inhibit_pid ; nohup systemd-inhibit --what=handle-lid-switch sleep 5m >/dev/null 2>&1 &";elif [ -x $

And with

set "args=!args! --start='nohup systemd-inhibit --what=handle-lid-switch sleep 1d ^>/dev/null 2^>^&1 ^& inhibit_pid=$^^! ; xpra xwait ; kill -9 $inhibit_pid ; nohup systemd-inhibit --what=handle-lid-switch sleep 5m ^>/dev/null 2^>^&1 ^&'"

(ie --start=''), we cannot even finish parsing:

"Inherit args:"
--ssh="plink -ssh -agent" --modal-windows=no --headerbar=off --title="@title@ on @@/@server-display@" -d ssh --encodings=-webp --start='nohup systemd-inhibit --what=handle-lid-switch sleep 1d >/dev/null 2>&1 & inhibit_pid=$^ ; xpra xwait ; kill -9 $inhibit_pid ; nohup systemd-inhibit --what=handle-lid-switch sleep 5m >/dev/null 2>&1 &' --microphone=off --speaker=off --webcam=no --pulseaudio=no

"Xpra-x86_64_6.0-r35043\xpra_cmd" shadow ssh://user@ip/1 --ssh="plink -ssh -agent" --modal-windows=no --headerbar=off --title="@title@ on @@/@server-display@" -d ssh --encodings=-webp --start='nohup systemd-inhibit --what=handle-lid-switch sleep 1d >/dev/null 2>&1 & inhibit_pid=$^ ; xpra xwait ; kill -9 $inhibit_pid ; nohup systemd-inhibit --what=handle-lid-switch sleep 5m >/dev/null 2>&1 &' --microphone=off --speaker=off --webcam=no --pulseaudio=no --opengl=no --min-speed=70 --key-shortcut=Shift+F2:toggle_pointer_grab

XPRA_EXECUTABLE=Xpra-x86_64_6.0-r35043

2024-03-25 23:56:27,427 xpra initialization error:
 no such option: --what

🤷 I'm a bit lost

stdedos avatar Mar 25 '24 22:03 stdedos

Likely fixed in 2044b89cbe5767b61adfd6b00c5916198c7b9bf1, see #4355 for details.

totaam avatar Oct 09 '24 10:10 totaam