joelspadin / vscode-remote-x11

Visual Studio Code extension that sets the DISPLAY environment variable in remote workspaces
39 stars 9 forks source link

Parse disposed and "Error: DISPLAY variable is missing" occur #12

Closed mireiffe closed 4 years ago

mireiffe commented 4 years ago

Thank you for making a very convenient extension. I have an issue when copying variable "DISPLAY".

Here are log lines in Remote X11 (SSH):

Connecting to xxx.xxx.xxx.xxx (I removed it) port 22
Connection ready. Setting up display...
Command for host "xxx.xxx.xxx.xxx (I removed it)" is: bash -c "echo DISPLAY=$DISPLAY"
----- Begin output from host -----

Last login: Tue Apr 28 17:18:00 2020 from xxx.xxx.xxx.xxx (I removed it)

========================= Sobolev - Cluster for Scientific Computation ==========================

Please execute your program after moving to other nodes.
You can move to node n by the prompt "ssh noden".
e.g. ssh node3

* Available nodes *
Group I: nodes 0-8
Group II: nodes 0,9-18
(GPU nodes: 0,7-10)
(Lastest nodes : 16-18) - faster than other nodes
For distributed computations, only nodes in the same group can be utilized simultaneously.

=================================================================================================
bash -c "echo DISPLAY=$DISPLAY"
%                                                                               

mireiffe@sobolev:~|⇒  [?1h=[?2004hbbash -c "echo DISPLAY=$DParser disposed.
Error: DISPLAY variable is missing.

Would you like to help? Thank you.

joelspadin commented 4 years ago

It looks like it never received the full result of the "echo DISPLAY=$DISPLAY" command. Maybe it timed out? I'd suggest increasing the remoteX11.SSH.timeout setting or changing it to 0 to disable the timeout.

joelspadin commented 4 years ago

Another thing you could try is changing the remoteX11.SSH.displayCommand setting on the remote server to something that prints more or less output. Some ideas:

Run directly instead of through another instance of bash to shorten the output:

echo DISPLAY=$DISPLAY

Print extra lines after the DISPLAY variable:

echo DISPLAY=$DISPLAY && echo "this is some meaningless text to hopefully flush the output so we can read the DISPLAY variable"
mireiffe commented 4 years ago

Thank you for the quick update. I did following your suggestions, and the results are identical to my original post.

  1. Changing the parameter remoteX11.SSH.timeout seems not to make any differences. and
  2. Changing remoteX11.SSH.displayCommand affect only the 3rd line of the Remote X11 (SSH)'s log which is: Command for host "xxx.xxx.xxx.xxx" is: echo DISPLAY=$DISPLAY && echo "this is some meaningless text to hopefully flush the output so we can read the DISPLAY variable"

I tried quite many combinations of shells, like bash, zsh and tcsh, and something like DISPLAY=$DISPLAY || echo "this is some meaningless text to hopefully flush the output so we can read the DISPLAY variable" but there are no progress so far.

joelspadin commented 4 years ago

I might know what's happening. Your server is probably sending output in small chunks, and at some point the end of the output looks like DISPLAY=. My parser currently thinks that looks like what the command would output if DISPLAY weren't set. I need to make it specifically look for a line break instead of just the end of the current text.

joelspadin commented 4 years ago

I just published a new version which I think will fix your issue. Check it out and let me know.

mireiffe commented 4 years ago

I checked the new version and it work properly!
Here is log lines for Remote X11. Thank you :)

Setting up display for remote "ssh-remote".
Connecting to SSH <server information> port 22
DISPLAY = localhost:15.0
joelspadin commented 4 years ago

Great!