question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

helpServer.R processes leaking in code-server

See original GitHub issue

Also posted on the code-server repo in case the fix needs to be with them: https://github.com/cdr/code-server/issues/4580

Describe the bug

Orphaned helpServer.R processes are leaking when opening and closing multiple R terminals in code-server.

> ps aux | grep helpServer.R
  565 ?        S      0:00 /bin/sh -c /usr/local/bin/R --silent --slave --no-save --no-restore -f /home/tjpalanca/.local/share/code-server/extensions/ikuyadeu.r-2.3.4/R/help/helpServer.R
  566 ?        Sl     0:23 /usr/local/lib/R/bin/exec/R --no-save --no-restore --silent --slave --no-save --no-restore -f /home/tjpalanca/.local/share/code-server/extensions/ikuyadeu.r-2.3.4/R/help/helpServer.R
  723 ?        S      0:00 /bin/sh -c /usr/local/bin/R --silent --slave --no-save --no-restore -f /home/tjpalanca/.local/share/code-server/extensions/ikuyadeu.r-2.3.4/R/help/helpServer.R
  724 ?        Sl     0:22 /usr/local/lib/R/bin/exec/R --no-save --no-restore --silent --slave --no-save --no-restore -f /home/tjpalanca/.local/share/code-server/extensions/ikuyadeu.r-2.3.4/R/help/helpServer.R
 1464 ?        S      0:00 /bin/sh -c /usr/local/bin/R --silent --slave --no-save --no-restore -f /home/tjpalanca/.local/share/code-server/extensions/ikuyadeu.r-2.3.4/R/help/helpServer.R
 1465 ?        Sl     0:05 /usr/local/lib/R/bin/exec/R --no-save --no-restore --silent --slave --no-save --no-restore -f /home/tjpalanca/.local/share/code-server/extensions/ikuyadeu.r-2.3.4/R/help/helpServer.R

Inspecting the tree for one of the orphaned processes, it’s clear that they are orphaned and no longer connected to the original code-server process.

> pstree -psa 566
s6-svscan,1 -t0 /var/run/s6/services
  └─sh,565 -c /usr/local/bin/R --silent --slave --no-save --no-restore -f /home/tjpalanca/.local/share/code-server/extensions/ikuyadeu.r-2.3.4/R/help/helpServer.R
      └─R,566 --no-save --no-restore --silent --slave --no-save --no-restore -f /home/tjpalanca/.local/share/code-server/extensions/ikuyadeu.r-2.3.4/R/help/helpServer.R
         ├─{R},574
         ├─{R},575
         └─{R},576

As opposed to a newly created R terminal:

> pstree -psa 2056
s6-svscan,1 -t0 /var/run/s6/services
  └─s6-supervise,414 vscode
      └─node,1672 /usr/lib/code-server --auth none --disable-telemetry --bind-addr 0.0.0.0:8788
          └─node,1706 /usr/lib/code-server --auth none --disable-telemetry --bind-addr 0.0.0.0:8788
              └─node,1724 /usr/lib/code-server/vendor/modules/code-oss-dev/out/vs/server/fork
                  └─node,1935 /usr/lib/code-server/vendor/modules/code-oss-dev/out/bootstrap-fork --type=extensionHost
                      └─sh,2055 -c /usr/local/bin/R --silent --slave --no-save --no-restore -f /home/tjpalanca/.local/share/code-server/extensions/ikuyadeu.r-2.3.4/R/help/helpServer.R
                          └─R,2056 --no-save --no-restore --silent --slave --no-save --no-restore -f /home/tjpalanca/.local/share/code-server/extensions/ikuyadeu.r-2.3.4/R/help/helpServer.R
                             ├─{R},2064
                             ├─{R},2065
                             └─{R},2066

To Reproduce

**This bug does not exist in local Visual Studio Code.

  1. Use code-server 3.12.0, vscode-R version 2.3.4
  2. Create an R terminal
  3. Close the R terminal
  4. Start another R terminal
  5. helpServer.R instances will keep piling up even if the original extensionHost was already killed.

Do you want to fix by self? (We hope your help!)

Yes, but I’m not exactly sure how to fix this.

(If yes,) what kind of help do you want? (e.g. Which file should I fix, Survey (related documents)

Need help to determine what could be causing it, and implementation?

Expected behavior

  1. Expect only one helpServer.R child process to persist for the whole session.

Screenshots If applicable, add screenshots to help explain your problem. You can show the keybord contents by pressing F1 and Developer: toggle screencast mode

Environment (please complete the following information):

  • OS: Linux
  • VSCode Version: code-server 3.12.0, vs code 1.60.0
  • R Version: 4.1.2
  • vscode-R version: 2.3.4

Additional context

I think it is because the child process is not killed when the extensionhost is killed? In regular vs code, there is only 1 extensionhost whereas code-server spawns new ones for different windows.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
renkun-kencommented, Dec 13, 2021

@tjpalanca Would you like to try the build from #912?

0reactions
tjpalancacommented, Dec 18, 2021

Will take a look, thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Orphaned processes left when extensionHost is killed #4580
R. Orphaned helpServer.R processes are leaking when opening and closing multiple R terminals in code-server. > ps aux | grep helpServer.
Read more >
Server is leaking memory; but process looks fine
We have two problems;. we tried to simulate the leakage using ANTS Memory Profiler, and we couldn't find the issue. WCF service itself...
Read more >
Visual Studio Code Server
The Visual Studio Code Server is a service you can run on a remote development machine, like your desktop PC or a virtual...
Read more >
Avoiding Memory Leaks in Visual Studio Editor Extensions
Other Common Leaks​​ Other common sources of memory leaks are: Static State: much like MEF part leaks, information stored in static fields and ......
Read more >
EXE COM Server Invokation leaking Handles - Rick Strahl
Last week I started looking into a problem that causes my IIS Worker processes to have errors on shutdown. After some mind numbing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found