Is it possible to have multiple rstudio-server sessions on the same server

Hi

I’ve made a few modifications to the default rstudio server app, namely to allow me to select from the list of different r versions in lmod. The plan is to make this part dynamic and grab this out of lmod but I’m not there yet, it’s hard coded for now.

I was trying to test both and they ended up getting scheduled to the same node. I though this wouldn’t be a problem as they will be running on different ports and the batch connect should connect to the right one.

This is not what I am seeing. Both end up connecting to the first created session ant the first session gets logged out when the second attepmt happens. Point to note is that I am running both connections as the same user. Should this matter? Is this expected?

thanks

Antony

Yes it should be possible.

This is strange, because when the second session boots, if it decided to take the same port, it would likely just fail, given you can’t bind to the same port. So why would it be the case that it seemingly booted correctly?

You may have to attach logs for both the first and second sessions. Specifically the log lines that say what host/port it’s binding to. We randomly generate a port to bind to, so it should be the case.

Also, when you say ‘default rstudio app’ do you mean our example here?. Have you modified any of the parts that allocate ports, or write the connection.yml file?

I have used the example rstudio app. My changes are in github https://github.com/antonycleave/RStudio-OOD/

I’ve not touched any of the parts that allocated ports or write the connection.yml file and these parts seem to be working properly as is it connecting to the following different URLs:

URL= rnode/p2postnod0001.cluster/44979/
URL= rnode/p2postnod0001.cluster/63170/
(urls truncated as new users arent allowed > 2 links)

but when I connect the second session it still seems to connect to the first as I get an R Studio Session Disconnected warning.

One thing I did change was to remove the container as I couldn’t see what functionality it was adding over lmod. . . . I’m beginning to suspect this is the cause of this issue.

here are the output log files for the first session:

[rsupport@p2postvpo1 output]$ cat 65f9c781-f8b6-4541-890f-d13a3a396556/output.log 
Script starting...
Waiting for RStudio Server to open port 44979...
+ echo 'Starting up rserver...'
Starting up rserver...
+ rserver --www-port 44979 --auth-none 0 --auth-pam-helper-path /vscaler/home/rsupport/ondemand/data/sys/dashboard/batch_connect/dev/RStudio-With-Module-selector/output/65f9c781-f8b6-4541-890f-d13a3a396556/bin/auth --auth-encrypt-password 0 --rsession-path /vscaler/home/rsupport/ondemand/data/sys/dashboard/batch_connect/dev/RStudio-With-Module-selector/output/65f9c781-f8b6-4541-890f-d13a3a396556/rsession.sh
Discovered RStudio Server listening on port 44979!
Generating connection YAML file...

here is the log for the second session:

[rsupport@p2postvpo1 output]$ cat 5016cd70-2179-4749-a2e8-eb02cadbdcc7/output.log 
Script starting...
Waiting for RStudio Server to open port 63170...
+ echo 'Starting up rserver...'
Starting up rserver...
+ rserver --www-port 63170 --auth-none 0 --auth-pam-helper-path /vscaler/home/rsupport/ondemand/data/sys/dashboard/batch_connect/dev/RStudio-With-Module-selector/output/5016cd70-2179-4749-a2e8-eb02cadbdcc7/bin/auth --auth-encrypt-password 0 --rsession-path /vscaler/home/rsupport/ondemand/data/sys/dashboard/batch_connect/dev/RStudio-With-Module-selector/output/5016cd70-2179-4749-a2e8-eb02cadbdcc7/rsession.sh
Discovered RStudio Server listening on port 63170!
Generating connection YAML file...

only the first session has an rsession.log file however

[rsupport@p2postvpo1 output]$ cat 65f9c781-f8b6-4541-890f-d13a3a396556/rsession.log
Launching rsession...
+ exec rsession --r-libs-user '' -u rsupport --launcher-token 2E5C936E --log-stderr 1
[rsupport@p2postvpo1 output]$ cat 5016cd70-2179-4749-a2e8-eb02cadbdcc7/rsession.log
cat: 5016cd70-2179-4749-a2e8-eb02cadbdcc7/rsession.log: No such file or directory

This is why I see that it has launched with R version 3.5.1 in both in spite of me requesting 3.6.0 in the 2nd session:

[rsupport@p2postvpo1 output]$ cat 65f9c781-f8b6-4541-890f-d13a3a396556/user_defined_context.json 
{
  "bc_account": "",
  "bc_queue": "",
  "bc_num_hours": "1",
  "bc_num_slots": "1",
  "modules": "lang/R/3.5.1-foss-2018b",
  "bc_email_on_started": "0"
}[rsupport@p2postvpo1 output]$ cat 5016cd70-2179-4749-a2e8-eb02cadbdcc7/user_defined_context.json 
{
  "bc_account": "",
  "bc_queue": "",
  "bc_num_hours": "1",
  "bc_num_slots": "1",
  "modules": "lang/R/3.6.0-foss-2019a",
  "bc_email_on_started": "0"
}[rsupport@p2postvpo1 output]$ 

I find this odd as the rsession commands are supposed to log to the individual dirs
[rsupport@p2postvpo1 output]$ diff 65f9c781-f8b6-4541-890f-d13a3a396556/rsession.sh 5016cd70-2179-4749-a2e8-eb02cadbdcc7/rsession.sh
4c4
< export RSESSION_LOG_FILE="/vscaler/home/rsupport/ondemand/data/sys/dashboard/batch_connect/dev/RStudio-With-Module-selector/output/65f9c781-f8b6-4541-890f-d13a3a396556/rsession.log"

> export RSESSION_LOG_FILE="/vscaler/home/rsupport/ondemand/data/sys/dashboard/batch_connect/dev/RStudio-With-Module-selector/output/5016cd70-2179-4749-a2e8-eb02cadbdcc7/rsession.log"

When I close the first Session I can log into the second session. RStudio gives me an “R Session Error”. “The previous R session was abnormally terminated due to an unexpected crash, You may have lost workspace data as a result of this crash.”

Any suggestions are gratefully received

Antony

RStudio server has hard coded paths for certain temporary files; in order to start multiple concurrent RStudio instances you must provide each with its own unique /tmp/. Looking at your script.sh.erb I see that you are not using either Singularity which is our current recommendation or proot which was the old method to provide the process a unique /tmp/.

Thanks, I thought it was something like that.

I’ll put the singularity container back in and retry. Maybe I skimmed over it during my installation but it might be an idea to add why the container is needed to the setup singularity page.

I looked at that singularity file and thought “this singularity container appears to do nothing I wonder if it works without” and until I started 2 sessions it did :slight_smile: so I thought I was good. Obviously not!

Antony

1 Like