Vscode-remote-release: sleep infinity processes

Created on 12 Jul 2019  Â·  23Comments  Â·  Source: microsoft/vscode-remote-release

Issue Type: Bug

While remote SSH is running, I see a handful of sleep infinity processes on the remote machine. I would prefer not to have this process clutter. I don't remember seeing them in previous releases, is this new behavior? Any workaround to having these, and what is their purpose?

Extension version: 0.44.1
VS Code version: Code 1.36.1 (2213894ea0415ee8c85c5eea0d0ff81ecc191529, 2019-07-08T22:59:35.033Z)
OS version: Windows_NT x64 10.0.17134
Remote OS version: Linux x64 3.10.0-957.5.1.el7.x86_64

bug ssh verified

Most helpful comment

Will be fixed in tomorrow's nightly build

All 23 comments

I see this, this might be fixed by adding the -t option back to our ssh commands but I need to work out exactly what the consequences of that are.

Experimenting in an external terminal, -t seems to fix it. But that is not doing it in vscode...

But I could replace it with an infinite loop containing a sleep x which will die after x seconds, that is safer.

Will be fixed in tomorrow's nightly build

If I'm not on the "nightly" build, what version of the extension will fix this? I'm currently on 0.44.2

This is still happening to me...

version: 1.37.0-insider
commit: 5e08ee01b7daee99cdda2456f19d77e715fb8762
date: 2019-08-05T21:16:01.319Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Darwin x64 18.2.0

@lisnb: it might be useful to report the version of the extension you're
using. You can find that by clicking on the Extensions tab in the sidebar
and it'll list it.

I am currently on 0.44.2 and am still seeing the issue.

--

On Wed, Aug 7, 2019 at 5:54 AM lisnb notifications@github.com wrote:

This is still happening to me...

version: 1.37.0-insider
commit: 5e08ee01b7daee99cdda2456f19d77e715fb8762
date: 2019-08-05T21:16:01.319Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Darwin x64 18.2.0

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/microsoft/vscode-remote-release/issues/968?email_source=notifications&email_token=AACGX4ZCYE4TYDTNE6KFCCDQDKLWDA5CNFSM4ICO6XY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3X32GY#issuecomment-519027995,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AACGX4YRTNOVZRNZCRM6TQDQDKLWDANCNFSM4ICO6XYQ
.

@alanhoyle thanks !
got confused between remote-ssh and vscode it self, orz

I'm currently using 0.45.3

btw,

  • I noticed that there is always a bash process along with the sleep infinity process
  • When I disconnect from my company's network, remote-ssh gets disconnected too, usually it'll fail to try to reconnect when I connect back, so I use Developer: reload window a lot

closing connection leaves processes running and leaves an open tunnel.
several:
sleep infinity
bash

/.vscode-server/bin/2213894ea0415ee8c85c5eea0d0ff81ecc191529/node
I am on remote ssh version 0.45.2

After upgrading to the stable July release v1.37, (remote extension v0.45.4) it looks like this was just replaced with sleep 180 in an infinite loop. I think that's worse actually.

From the integrated terminal:

$ pstree $USER
sh───node─┬─node─┬─bash───pstree
          │      └─14*[{node}]
          └─11*[{node}]

sshd───bash───sleep
$ ps ux
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
username   60338  0.0  0.0   9520  1320 ?        S    11:07   0:00 sh /home/username/.vscode-server/bin/036a6b1d3ac84e5ca96a17a44e63a87971f8fcc8/server.sh --enable-remote-auto-shutdown --disable-telemetry --port=0
username   60347  0.2  0.0 891036 34796 ?        Sl   11:07   0:00 /home/username/.vscode-server/bin/036a6b1d3ac84e5ca96a17a44e63a87971f8fcc8/node /home/username/.vscode-server/bin/036a6b1d3ac84e5ca96a17a44e63a87971f8fcc8/out/vs/server/main.js --enable-remote-auto-shutdown --disable-telemetry --port=0
username   60423  0.0  0.0 179896  2912 ?        S    11:07   0:00 sshd: username@notty
username   60432  0.0  0.0   9524  1280 ?        Ss   11:07   0:00 bash
username   60993  0.3  0.0 1001256 41280 ?       Sl   11:07   0:01 /home/username/.vscode-server/bin/036a6b1d3ac84e5ca96a17a44e63a87971f8fcc8/node /home/username/.vscode-server/bin/036a6b1d3ac84e5ca96a17a44e63a87971f8fcc8/out/bootstrap-fork --type=extensionHost --uriTransformerPath=/home/username/.vscode-server/bin/036a6b1d3ac84e5ca96a17a44e63a87971f8fcc8/out/vs/server/uriTransformer.js
username   61030  0.0  0.0 126172  2664 pts/7    Ss   11:07   0:00 /bin/bash
username   65175  0.0  0.0   4320   348 ?        S    11:13   0:00 sleep 180
username   65207  0.0  0.0 165576  1952 pts/7    R+   11:13   0:00 ps ux

Is that loop just intended to keep sshd from terminating?

I was expecting something more like this:

sshd───sh───node─┬─node─┬─bash───pstree
                 │      └─14*[{node}]
                 └─11*[{node}]

or even better yet:

sshd───node─┬─node─┬─bash───pstree
            │      └─14*[{node}]
            └─11*[{node}]

Sorry I don't understand what you're trying to tell me. The process should terminate no longer than 3 minutes after the connection is closed instead of leaking processes.

For me, the sleep 180 dies after 3 minutes and the instantly gets replaced with a new sleep 180 process.

In the ps ux dump above, you can see the server was started at 11:07, but the sleep 180 started again at 11:10 and 11:13 (and still continues now).

Thanks for looking into this!

To be clear, that is the expected behavior while vscode is open. But you are saying that you still see these appearing after vscode has closed?

You're right, the issue with the sleep infinity being left over from other connection is fixed now, since they die <3 minutes after the connection closes.

That's probably the more important fix, but my initial question was also about the use of any sleep processes in general. If I understand correctly, after removing forced pseudo-tty allocation (ssh -t), we need to have this bash script (something like while true; do sleep 180; done) in order to keep the connection alive. Before, I remembered only having sshd and no sleep processes. If we used -t again, could we just get rid of the sleeps altogether? Maybe by user setting?

BTW, I was looking for the source code, but couldn't find it. Is it in a private repo? I searched all over for "sleep", "infinity", "180", "ssh", ...

Thanks!

Yes, the code is in a private repo for now. I would still need sleep even with -t becuse I have to run a script then prevent it from exiting, so the connection forwarding the port stays open. Is this causing a problem?

I don't know what the proper solution to maintaining a connection is, but I do know that my sysadmin emailed me about the dozens of "sleep infinity" processes on one of our login nodes. :)

--
Alan Hoyle - [email protected] - https://www.alanhoyle.com/


From: Rob Lourens notifications@github.com
Sent: Friday, August 9, 2019 5:51 PM
To: microsoft/vscode-remote-release
Cc: Alan Hoyle; Mention
Subject: Re: [microsoft/vscode-remote-release] sleep infinity processes (#968)

Yes, the code is in a private repo for now. I would still need sleep even with -t becuse I have to run a script then prevent it from exiting, so the connection forwarding the port stays open. Is this causing a problem?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/microsoft/vscode-remote-release/issues/968?email_source=notifications&email_token=AACGX4YKJIHB7VYVSCPHEXLQDXRGTA5CNFSM4ICO6XY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD373SII#issuecomment-520075553, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AACGX453A24ZDOLGCQUJKZDQDXRGTANCNFSM4ICO6XYQ.

The 'infinity' ones were being leaked, sorry about that. The new solution should not leak processes and will hopefully be enough to keep your sysadmin happy!

What version of the extension has this fixed? I just updated my VSCode, and it went from 0.44.2 to 0.45.4, and now I'm seeing "sleep 180" processes. (and I presume that the bug is fixed?)

Yes, see above

Would it be possible to use SSH config options like ServerAliveCountMax, ServerAliveInterval, or maybe even TCPKeepAlive to do this? I think ClientAliveCountMax and ClientAliveInterval are sshd configuration things, so I'm not sure if those are within our control.

http://fibrevillage.com/sysadmin/172-how-to-keep-idle-ssh-connection-alive

No, that's not solving the same problem. This is about running a command and not terminating when the command is complete.

Version 0.45.5 and still a bunch of sleep infinity about. Do I need to switch to the nightly for the fix?

I'm not seeing that anymore. it might be worth running a "ps -ux | grep
sleep" to see how long the "sleep infinity" processes have been there.

You could then do a "killall sleep" or do something fancier with grep and
other command-line stuff to only kill the "sleep infinity" processes.

--

On Mon, Aug 19, 2019 at 6:11 PM Reio Remma notifications@github.com wrote:

Version 0.45.5 and still a bunch of sleep infinity about. Do I need to
switch to the nightly for the fix?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/microsoft/vscode-remote-release/issues/968?email_source=notifications&email_token=AACGX47OOZ3S5LKY7PY2XVTQFMLB5A5CNFSM4ICO6XY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4UOJ7I#issuecomment-522773757,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AACGX43K5PBPZSO7BBAHQKLQFMLB5ANCNFSM4ICO6XYQ
.

Ahh, that’s right! They were indeed a week old processes.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sulume picture sulume  Â·  3Comments

kieferrm picture kieferrm  Â·  3Comments

peterkappelt picture peterkappelt  Â·  3Comments

jkoritzinsky picture jkoritzinsky  Â·  3Comments

abdullahiabdirahman picture abdullahiabdirahman  Â·  3Comments