VSCode Insiders Remote SSH stopped working - vscode-remote

I'm using Visual Studio Code Insiders version 1.65.0-insider. Until 3 days ago, I was not having any problem connecting to the remote server at work from my work laptop through a VPN. I have my ssh config file and when I opened vscode (when connected to the VPN), I was asked for my password and it connected without problems.
However, from yesterday I have started getting an error stating Could not establish connection to idk4v: The VS Code Server failed to start. idk4v is the remote machine's name that I gave in my ssh config file. I also get Waiting for server log... in the output continuously. I am pasting the output here from trying out just now. I have removed the non-essential parts for brevity:
[08:27:13.110] Log Level: 2
[08:27:13.113] remote-ssh#0.70.0
[08:27:13.113] win32 x64
[08:27:13.114] SSH Resolver called for "ssh-remote+idk4v", attempt 1
[08:27:13.114] "remote.SSH.useLocalServer": false
[08:27:13.114] "remote.SSH.showLoginTerminal": false
[08:27:13.114] "remote.SSH.remotePlatform": {"idk4l":"linux","idk4v":"linux"}
[08:27:13.114] "remote.SSH.path": undefined
[08:27:13.115] "remote.SSH.configFile": undefined
[08:27:13.115] "remote.SSH.useFlock": true
[08:27:13.115] "remote.SSH.lockfilesInTmp": false
[08:27:13.115] "remote.SSH.localServerDownload": auto
[08:27:13.115] "remote.SSH.remoteServerListenOnSocket": false
[08:27:13.115] "remote.SSH.showLoginTerminal": false
[08:27:13.115] "remote.SSH.defaultExtensions": []
[08:27:13.115] "remote.SSH.loglevel": 2
[08:27:13.115] "remote.SSH.serverPickPortsFromRange": {}
[08:27:13.115] "remote.SSH.enableDynamicForwarding": true
[08:27:13.115] "remote.SSH.serverInstallPath": {}
[08:27:13.116] SSH Resolver called for host: idk4v
[08:27:13.116] Setting up SSH remote "idk4v"
[08:27:13.128] Using commit id "50089c3f92c17584a4aca179f51f220b56c22020" and quality "insider" for server
[08:27:13.130] Install and start server if needed
[08:27:13.132] Checking ssh with "ssh -V"
[08:27:13.159] > OpenSSH_for_Windo
[08:27:13.159] > ws_8.1p1, LibreSSL 3.0.2
[08:27:13.162] Running script with connection command: ssh -T -D 51608 idk4v bash
[08:27:13.163] Terminal shell path: C:\windows\System32\cmd.exe
[08:27:13.361] > ]0;C:\windows\System32\cmd.exe
[08:27:13.362] Got some output, clearing connection timeout
[08:27:17.073] >
>
[08:27:24.396] Showing password prompt
[08:27:27.658] Got password response
[08:27:27.658] "install" wrote data to terminal: "********"
[08:27:27.677] >
[08:27:28.215] > 796e33571197: running
[08:27:28.272] > Acquiring lock on /home/su0/.vscode-server-insiders/bin/50089c3f92c17584a4aca179f51f220b56c22020/vscode-remote-lock.su0.50089c3f92c17584a4aca179f51f220b56c22020
[08:27:28.296] > Found existing installation at /home/su0/.vscode-server-insiders/bin/50089c3f92c17584a4aca179f51f220b56c22020...
> Checking /home/su0/.vscode-server-insiders/.50089c3f92c17584a4aca179f51f220b56c22020.log and /home/su0/.vscode-server-insiders/.50089c3f92c17584a4aca179f51f220b56c22020.pid for a running server
[08:27:28.306] > Looking for server with pid: 294423
[08:27:28.413] > Starting server with command... /home/su0/.vscode-server-insiders/bin/50089c3f92c17584a4aca179f51f220b56c22020/server.sh --start-server --host=127.0.0.1 --enable-remote-auto-shutdown --port=0 &> "/home/su0/.vscode-server-insiders/.50089c3f92c17584a4aca179
> f51f220b56c22020.log" < /dev/null
> printenv:
[08:27:28.431] > XDG_SESSION_ID=219
> SELINUX_ROLE_REQUESTED=
> SHELL=/bin/zsh
> SSH_CLIENT=10.159.165.35 51610 22
> SELINUX_USE_CURRENT_RANGE=
> USER=su0
> VSCODE_AGENT_FOLDER=/home/su0/.vscode-server-insiders
> MAIL=/var/mail/su0
> PATH=/usr/local/bin:/usr/bin
> PWD=/home/su0
> SELINUX_LEVEL_REQUESTED=
> SHLVL=1
> HOME=/home/su0
> LOGNAME=su0
> SSH_CONNECTION=10.159.165.35 51610 10.1.164.50 22
> XDG_RUNTIME_DIR=/run/user/46546
> _=/usr/bin/printenv
> Spawned remote server: 6344
> Waiting for server log...
Waiting for server log...
[08:27:36.044] >
> *
> * Reminder: You may only use this software with Visual Studio family products,
> * as described in the license (https://go.microsoft.com/fwlink/?linkid=2077057)
> *
>
[08:27:36.055] >
> Server did not start successfully. Full server log at /home/su0/.vscode-server-insiders/.50089c3f92c17584a4aca179f51f220b56c22020.log >>>
> server.sh is being replaced by 'bin/code-server-insiders'. Please migrate to the new command and adopt the following new default behaviors:
> * connection token is mandatory unless --without-connection-token is used
> * host defaults to `localhost`
> *
> * Visual Studio Code Server
> *
> * By using the software, you agree to
> * the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
> * the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
> *
> Do you accept the terms in the License Agreement?<<< End of server log
> 796e33571197: start
> exitCode==32==
> listeningOn====
> osReleaseId==centos==
> arch==x86_64==
> tmpDir==/run/user/46546==
> platform==linux==
> unpackResult====
> didLocalDownload==0==
> downloadTime====
> installTime====
> extInstallTime====
> serverStartTime==7623==
> 796e33571197: end
[08:27:36.055] Received install output:
exitCode==32==
listeningOn====
osReleaseId==centos==
arch==x86_64==
tmpDir==/run/user/46546==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime==7623==
[08:27:36.056] Resolver error: Error: The VS Code Server failed to start
at Function.ServerInstallError (c:\Users\su0\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.70.0\out\extension.js:1:430359)
at u (c:\Users\su0\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.70.0\out\extension.js:1:424682)
at Object.t.handleInstallOutput (c:\Users\su0\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.70.0\out\extension.js:1:429101)
at Object.t.tryInstall (c:\Users\su0\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.70.0\out\extension.js:1:524212)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async c:\Users\su0\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.70.0\out\extension.js:1:487216
at async Object.t.withShowDetailsEvent (c:\Users\su0\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.70.0\out\extension.js:1:490561)
at async Object.t.resolve (c:\Users\su0\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.70.0\out\extension.js:1:488295)
at async c:\Users\su0\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.70.0\out\extension.js:1:564197
[08:27:36.060] ------
[08:27:36.285] >
[08:27:37.355] "install" terminal command done
[08:27:37.355] Install terminal quit with output:
I tried this solution, where I both killed and uninstalled the VS Code Server on the host, deleted the ~/.vscode-server-insiders directory on the remote server, restarted VS Code, and tried to reconnect to the server. But I got the same error. I couldn't find any other solution. Any help is appreciated.

This is very much a hack and absolutely not a long term solution but as a quick work around.
Find the server.sh path in the log you posted, open it in an editor, and add --accept-server-license-terms to the last line so it looks something like "$ROOT/node" ${INSPECT:-} "$ROOT/out/server-main.js" --compatibility=1.63 --accept-server-license-terms "$#". This will accept the terms automatically until this gets patched by MS.

on Windows check
C:\Users\yourusername.vscode-cli\license_consent.json
for
{"consented":true}
I had the same type of problem connecting to remote servers with the waiting for server log. I found the post here, and as was working on repeated tries, I notice my C:\Users\myid.vscode-cli\license_consent.json just showed up 2/18/2023 7:57 PM PST. Now, I can assess. Not sure why it finally showed up.

Related

Issue to use SSH with VSCODE & windows server

I try to use the remote-ssh for windows on vscode but the installation on the server failed.
The server it's a windows server 2022
I spend time on internet to find a way but it's was a failure.
server.cmd' --start-server --host=127.0.0.1 --enable-remote-auto-shutdown --port=0 --connection-secret
[11:00:34.015] >
[11:00:38.215] > Server did not start successfully. Full server log at C:\Users\XXXX\.vscode-server\.97dec172d3256f8ca4bfb2143f3f76b503ca0534.log >>>
> C:\Users\XXXX\.vscode-server\bin\97dec172d3256f8ca4bfb2143f3f76b503ca0534\server.cmd :
> server.sh is being replaced by 'bin/code-server'. Please migrate to the new command and adopt the
> following new default behaviors:
> At line:1 char:1
> + C:\Users\XXXX\.vscode-server\bin\97dec172d3256f8ca4bfb2143f3f76b ...
> + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[11:00:38.222] >
> + CategoryInfo : NotSpecified: (server.sh is be...ault behaviors::String) [], RemoteE
> xception
> + FullyQualifiedErrorId : NativeCommandError
>
Anyone have a solution for that ?
Kr
Jerry
use vscode with ssh

In Python, how do I construct a URL to test if my SQL Server instance is running?

I'm using Python 3.8 with the pytest-docker-compose plugin -- https://pypi.org/project/pytest-docker-compose/ . Does anyone know how to write a URL that would eventually tell me if my SQL Server is running?
I have this docker-compose.yml file
version: "3.2"
services:
sql-server-db:
build: ./
container_name: sql-server-db
image: microsoft/mssql-server-linux:2017-latest
ports:
- "1433:1433"
environment:
SA_PASSWORD: "password"
ACCEPT_EULA: "Y"
but I don't know what URL to pass to my Retry object to test that the server is running. This fails ...
import pytest
import requests
from urllib3.util.retry import Retry
from requests.adapters import HTTPAdapter
...
#pytest.fixture(scope="function")
def wait_for_api(function_scoped_container_getter):
"""Wait for sql server to become responsive"""
request_session = requests.Session()
retries = Retry(total=5,
backoff_factor=0.1,
status_forcelist=[500, 502, 503, 504])
request_session.mount('http://', HTTPAdapter(max_retries=retries))
service = function_scoped_container_getter.get("sql-server-db").network_info[0]
api_url = "http://%s:%s/" % (service.hostname, service.host_port)
assert request_session.get(api_url)
return request_session, api_url
with this exception
raise ConnectionError(e, request=request)
E requests.exceptions.ConnectionError: HTTPConnectionPool(host='0.0.0.0', port=1433): Max retries exceeded with url: / (Caused by ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')))
if connection.is_connected():
db_Info = connection.get_server_info()
print("Connected to MySQL Server version ", db_Info)
cursor = connection.cursor()
cursor.execute("select database();")
record = cursor.fetchone()
print("You're connected to database: ", record)
you could use something like this and it would output if it was connected
Here is a sample function that will retry to connect to the DB and won't return until it has successfully connected or the defined maxRetries is reached:
def waitDb(server, database, username, password, maxAttempts, waitBetweenAttemptsSeconds):
"""
Returns True if the connection is successfully established before the maxAttempts number is reached
Conversely returns False
pyodbc.connect has a built-in timeout. Use a waitBetweenAttemptsSeconds greater than zero to add a delay on top of this timeout
"""
for attemptNumber in range(maxAttempts):
cnxn = None
try:
cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER='+server+';DATABASE='+database+';UID='+username+';PWD='+ password)
cursor = cnxn.cursor()
except Exception as e:
print(traceback.format_exc())
finally:
if cnxn:
print("The DB is up and running: ")
return True
else:
print("DB not running yet on attempt numer " + str(attemptNumber))
time.sleep(waitBetweenAttemptsSeconds)
print("Max attempts waiting for DB to come online exceeded")
return False
I wrote a minimal example here: https://github.com/claudiumocanu/flow-pytest-docker-compose-wait-mssql.
I included the three actions that can be executed independently, but you can jump to the last step specifically for what you asked:
1. Connected from python to the mssql launched by the compose-file:
For me it was quite annoying to find and install the appropriate ODBC Driver and its dependencies - ODBC Driver 17 for SQL Server worked the best for me on Ubuntu 18.
To perform only this step, docker-compose up the the docker-compose.yml in my example, then run the example-connect.py
2. Created a function that attempts to connect to the DB with a maxAttemptsNumber and a delay between retries:
Just run this example-waitDb.py. You can play with the maxAttempts and the delayBetweenAttempts values, then bring up the database at randomly, to test it.
3. Put everything together in the test_db.py test suite:
the waitDb function described above.
same wrapper and annotations that you provided in your example to spin-up the resources defined in the compose-file
a dummy integration test that will not be executed before waitDb returns (if you want to block this tests completely, you can throw instead of returning False from the waitDb function)
PS: Keep using ENVs/vault etc rather than storing the real passwords like I did for the dummy example.

Mongoose opening multiple unwanted TCP sockets on reconnect

Wanting to test a mongoDB server up/down procedure connected to Node/Mongoose, we found out that Mongoose can sometimes open hundreds of TCP sockets (which is not necessary and potentially blocking for the user who is limited to a certain amount of sockets). This occurs in the following case and environment :
Node supervised with PM2 and MongoDB surevised with daemontools
At normal and clean startup :
$ netstat -alpet | grep mongo
tcp 0 0 *:27017 *:* LISTEN mongo 65910844 22930/mongod
tcp 0 0 localhost.localdomain:27017 localhost.localdomain:54595 ESTABLISHED mongo 6591110422930/mongod
The last "ESTABLISHED" line repeated 5 times since the option (poolSize: 5) is specified in Mongoose ("mongo" is the user running mongod under daemontools)
When we have the Node procedure :
mongoose.connection.on('disconnected', function () {
var options = {server: { auto_reconnect:true, poolSize: 5 ,socketOptions: { connectTimeoutMS: 5000 } }
}
console.log('Mongoose default connection disconnected ' + mongoose.connection.readyState);
mongoose.connect( dbURI, options );
});
and we bring down the MongoDB by daemontools (mongodbdaemon is a simple $mongod command) :
svc -d /service/mongodbdaemon
there is of course no mongod running in the system (tested by the netstat command ) and the web server pages called which are using mongoose announce what is normal :
{"name":"MongoError","message":"topology was destroyed"}
The problem occurrs at this stage. Since the time we bring down MongoDB, Mongoose accumulates all the connect() calls in the 'disconnected' event handler. This means that the longer we wait before bringing up MongoDB, the more TCP connections will be opened.
So bringing up MongoDB by
svc -u /service/mongodbdaemon
gives the following :
$ netstat -alpet | grep mongo | wc -l
850 'ESTABLISHED' TCP connections to mongod !
If we bring down again mongod, the hundreds of connections remain in the TIME_WAIT state until Linux cleans the socket pool.
Questions
Can we check if a MongoDB instance is available before connecting to it ?
Can we configure Mongoose not to accumulate reconnecting() tries every millisecond or so ?
Is there a buffer for pending connection operations (as there is for mongoose.insert[...]) that we can access or clean manually ?
Problem reproductible on a CentOS 6.7 / mongoDB 3.0.6 / mongoose 4.1.8 / node 4.0.0
Edit :
From the official mongoose site where I posted this question after posting it here, I received an answer : "using auto_reconnect : true, on the initial connect() operation (which is set by default) there is no reason to reconnect() in a disconnect event callback".
This is true and it works jute fine, but the question is now why does this happen and how to avoid it (it is serious enough on the Linux system level to be an issue in mongoose).
Thanks !

Nagios emails not received even when notification is fired poperly

After enabling detailed debugging, I can see that Nagios is firing notifications properly.. Here is what I see in nagios.logs
[1430915423] SERVICE ALERT: test;Check node port;CRITICAL;HARD;4;Connection refused
[1430915423] SERVICE NOTIFICATION: abhishek;test;Check node port;CRITICAL;notify-service-by-email;Connection refused
[1430915423] SERVICE NOTIFICATION: root;test;Check node port;CRITICAL;notify-service-by-email;Connection refused
However, I do not receive emails at the specified contact.. I am using SSMTP..
It is working fine as well.. This command works -
ssmtp abc#xxx.com
Therefore, either 2 things can happen -
notify-service-by-email
is not working OR some security check is filtering out such emails (this should not happen as I am sending emails from my email address).. Can any one suggest how to debug this..?
EDIT - Here is my notify-service-by-email command -
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
Finally found the issue..
sSMTP was working properly.. Tested it with this command -
ssmtp -s abcd#xxx.com
Enabled DEBUG logs to find out that /etc/ssmtp/ssmtp.conf did not have sufficient permission..
The file was owned by root instead of nagios user
Hope this helps someone..

Silverlight crashes FireFox 3.5, IE7, & IE8

One of my users has an HP Pavilion DV4-1430us laptop running Windows Vista Professional 64-bit. She is using the latest version of the Silverlight Plug-In, downloaded on 24 July from microsoft.com/silverlight.
While typing in a text box in a silverlight web application my company developed, all three browsers will occasionally crash. Nine times out of ten, she can go back to the page where the crash occurred and pick up from where she left off, only to have it crash again several minutes later.
This only occurs while she is typing in a text box, and it only occurs on her laptop. I have watched her to confirm there is no user error.
Any thoughts?
Edit 1: I replicated the error. In Firefox 3.5, the window in which I was working closed with no warning, and the Mozilla Crash Reporter popped up. I'm pasting the crash report code:
Add-ons: {20a82645-c095-46ed-80e3-08825760534b}:1.1,{972ce4c6-7e08-4474-a285-3208198ce6fd}:3.5.1
BuildID: 20090715094852
CrashTime: 1248713784
InstallTime: 1248455260
ProductName: Firefox
SecondsSinceLastCrash: 245055
StartupTime: 1248713511
Theme: classic/1.0
Throttleable: 1
URL: [redacted]
Vendor: Mozilla
Version: 3.5.1
Edit 2: I replicated the error in IE8. I highlighted the text in a text box and began to type. Instantly,
Internet Explorer has stopped working
A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available.
appeared.
Here is the event log entry:
>Log Name: Application
>Source: Application Error
>Date: 7/27/2009 1:06:10 PM
>Event ID: 1000
>Task Category: (100)
>Level: Error
>Keywords: Classic
>User: N/A
>Computer: [computer name]
>Description:
>Faulting application iexplore.exe, version 8.0.6001.18702, time stamp 0x49b3ad2e, faulting module kernel32.dll, version 6.0.6000.16820, time stamp 0x4995210a, exception code 0xe0434352, fault offset 0x0001e05c, process id 0x1a54, application start time 0x01ca0edc4c7c0054.
>Event Xml:
><Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
> <System>
> <Provider Name="Application Error" />
> <EventID Qualifiers="0">1000</EventID>
> <Level>2</Level>
> <Task>100</Task>
> <Keywords>0x80000000000000</Keywords>
> <TimeCreated SystemTime="2009-07-27T17:06:10.000Z" />
> <EventRecordID>2636</EventRecordID>
> <Channel>Application</Channel>
> <Computer>[computer name]</Computer>
> <Security />
> </System>
> <EventData>
> <Data>iexplore.exe</Data>
> <Data>8.0.6001.18702</Data>
> <Data>49b3ad2e</Data>
> <Data>kernel32.dll</Data>
> <Data>6.0.6000.16820</Data>
> <Data>4995210a</Data>
> <Data>e0434352</Data>
> <Data>0001e05c</Data>
> <Data>1a54</Data>
> <Data>01ca0edc4c7c0054</Data>
> </EventData>
></Event>
The web app was written for Silverlight 2, and was trying to call System.ComponentModel.dll. The user was using the Silverlight 3 runtime, which does not include System.ComponentModel.
Solution: Downgrade user to Silverlight 2 until webapp can be rewritten for Silverlight 3.
Try disabling and re-enabling the Pen Tablet Service. It seems that Silverlight needs to access WispTis.exe or Wacomservice file for it to work properly. You can check to see if it is enabled by going to Control Panel > Administrative Tools > Services > Tablet PC Input Service. Make sure the service is started and set to automatic.
You should look at FireFox's bugzilla for issues in firefox. You'll get a lot better idea of what todo. If you look, you will see quite a number of simular faults.

Resources