Skip to content

helpServer.R processes leaking in code-server #902

@tjpalanca

Description

@tjpalanca

Also posted on the code-server repo in case the fix needs to be with them: coder/code-server#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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions