Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
stdedos opened this issue Jan 31, 2024 · 8 comments
Closed
Assignees
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@stdedos
Copy link
Collaborator

stdedos commented Jan 31, 2024

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: #4114

Relates to #4026?

@stdedos stdedos added the bug Something isn't working label Jan 31, 2024
@totaam
Copy link
Collaborator

totaam commented Feb 1, 2024

--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:

def main(script_file:str, cmdline) -> int:

Then eventually (via run_mode and run_client), we re-use it:

xpra/xpra/scripts/main.py

Lines 1334 to 1335 in ffb5abf

log("execv%s", (script_file, cmdline))
os.execv(script_file, cmdline)

I will have to do some testing.

@stdedos
Copy link
Collaborator Author

stdedos commented Feb 1, 2024

--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 😓

@totaam
Copy link
Collaborator

totaam commented Feb 1, 2024

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.

@stdedos stdedos added the wontfix This will not be worked on label Feb 22, 2024
@stdedos stdedos self-assigned this Feb 22, 2024
@stdedos
Copy link
Collaborator Author

stdedos commented Feb 22, 2024

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?

@totaam
Copy link
Collaborator

totaam commented Feb 23, 2024

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

@totaam
Copy link
Collaborator

totaam commented Mar 20, 2024

Bump?

@stdedos
Copy link
Collaborator Author

stdedos commented Mar 25, 2024

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

@totaam
Copy link
Collaborator

totaam commented Oct 9, 2024

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

@totaam totaam closed this as completed Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants