Closed JeffReeves closed 3 years ago
After a fair bit of troubleshooting, I managed to get connections to work.
It appears that an additional set of files I source in my ~/.bashrc
file is causing the connection to fail after vscode is installed.
I've commented them out for now, and will re-introduce them one at a time until I find which thing is at fault.
Narrowed it down to exporting a variable called DEBUG
...
I have a set of colored text variables I export for use in other scripts, such as:
export DEBUG="\033[1;30m[DEBUG]\033[0m"
Apparently I can use these variables but not DEBUG
:
INFO
TASK
COMMAND
PROMPT
HELP
SUCCESS
WARNING
ERROR
If I comment out the DEBUG
export, source ~/.bashrc
, and then kill and reload the remote SSH connection in VSCode, it works fine.
If I uncomment and re-enable the DEBUG
export, source ~/.bashrc
, kill and reload the SSH connection in VSCode, it fails with the error I put in the original post.
This is a really odd thing to encounter. I'm guessing there's some sort of build process where the DEBUG
env variable carries some special meaning, and my export is causing a conflict. Could anyone tell me why the exporting a DEBUG
variable is causing this issue?
I'll work on changing my approach to making those variables available to my bash scripts in the meantime.
cc @roblourens @Chuxel Is it a known experience/limitation that a DEBUG
env variable carries special meaning and would cause the user's connection to fail?
If this is expected, I looked through our docs and didn't see anything about it, and it feels like we should mention something about it?
@roblourens Does DEBUG
this have special meaning to anything for Remote - SSH? I could certainly see it getting picked up by something and processed like it should be 0 or 1 or true or false rather than a color.
@JeffReeves How is DEBUG
being processed? Normally I'd recommend using something with a prefix rather than just DEBUG given how likely it is that this could be picked up by some tool other than the one you are wanting - but don't know if that's an option.
@Chuxel - The DEBUG
env variable is being exported in a ~/.bashrc
file like this:
export DEBUG="\033[1;30m[DEBUG]\033[0m"
I was using it for colored output in my shell scripts, like:
echo "${DEBUG} This is a debug statement" --> [DEBUG] This is a debug statement
I've since rethought how I was including these macros for colored output in messages and have opted to just create a function called messages
that I can pass parameters to, such as:
message DEBUG "This is a debug statement" --> [DEBUG] This is a debug statement
.
It took me a little while to figure out that exporting a DEBUG
env variable of any value was causing my VSCode Remote connectivity issue. I've had this little script for years without issues (at least none that I noticed) and this was the first time it truly broke something.
Interesting, I can repro. We spawn an EH and it shuts down immediately
[15:40:12] [127.0.0.1][cd572682][ExtensionHostConnection] <27672> Launched Extension Host Process.
[15:40:12] [127.0.0.1][cd572682][ExtensionHostConnection] <27672> Extension Host Process exited with code: 0, signal: null.
I don't know of anywhere that we read this, but DEBUG is commonly used by npm modules and I can imagine that some dependency is either crashing or producing too much output and causing a crash. cc @alexdima
Easy repro in local vscode:
DEBUG: '['
[81595:0803/160931.596946:INFO:CONSOLE(104)] "%c[Extension Host] %cSyntaxError: Invalid regular expression: /^[$/: Unterminated character class
at new RegExp (<anonymous>)
at Function.enable (/Users/roblou/code/vscode/node_modules/get-uri/node_modules/debug/src/common.js:179:28)
at setup (/Users/roblou/code/vscode/node_modules/get-uri/node_modules/debug/src/common.js:261:14)
at Object.<anonymous> (/Users/roblou/code/vscode/node_modules/get-uri/node_modules/debug/src/node.js:236:37)
at Module._compile (internal/modules/cjs/loader.js:1078:30)
at Object..js (internal/modules/cjs/loader.js:1108:10)
at Module.load (internal/modules/cjs/loader.js:935:32)
at internal/modules/cjs/loader.js:776:14
at Function._load (electron/js2c/asar_bundle.js:5:12913)
at Module.require (internal/modules/cjs/loader.js:959:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/Users/roblou/code/vscode/node_modules/get-uri/node_modules/debug/src/index.js:9:19)
at Module._compile (internal/modules/cjs/loader.js:1078:30)
at Object..js (internal/modules/cjs/loader.js:1108:10)
at Module.load (internal/modules/cjs/loader.js:935:32)
at internal/modules/cjs/loader.js:776:14
at Function._load (electron/js2c/asar_bundle.js:5:12913)
at Module.require (internal/modules/cjs/loader.js:959:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/Users/roblou/code/vscode/node_modules/get-uri/dist/index.js:5:33)
at Module._compile (internal/modules/cjs/loader.js:1078:30)
at Object..js (internal/modules/cjs/loader.js:1108:10)
at Module.load (internal/modules/cjs/loader.js:935:32)
at internal/modules/cjs/loader.js:776:14
at Function._load (electron/js2c/asar_bundle.js:5:12913)
Relevant: https://github.com/visionmedia/debug/issues/288, https://github.com/visionmedia/debug/pull/250,
I think the right fix is to just strip the DEBUG environment variable at the line I pointed at above. I don't think this would change anything for us because I'm not aware of us relying on this in any debugging workflow. But I will leave it for @alexdima
Thanks for the narrowing this down @JeffReeves!
@roblourens Thank you for getting attention to this! I seem to have a magic touch for breaking things in very unexpected ways lol.
Verification steps:
export DEBUG='['
/verified on my end. Thank you all for this fix!
VSCode 1.57.0:
VSCode 1.58.0-insiders:
Steps to Reproduce:
ssh jeff@bridges
).Does this issue occur when you try this locally?: Yes Does this issue occur when you try this locally and all extensions are disabled?: Yes
Troubleshooting Attempts:
I've tried running the "Remote-SSH: Kill VS Code Server on Host" option, deleting the
~/.vscode-server*
directories manually, killing all processes related to vscode on the remote server, etc. but nothing seems to resolve the issue.I'm able to connect using SSH in Windows Terminal and git bash just fine, so I don't see why the connection fails after it appears to be established to download vscode-server.
Oddly enough, this issue only happens on my local home lab server ("bridges") and not on one of my production servers running on Digital Ocean ("uca").
Additional Details on Failing Home Lab Connection
Host Client/.ssh/config:
Remote Server details:
Additional Details on Working Digital Ocean Connection
Remote Server Details: