Hi guys,
The topic in RStudio-Server locks session - #6 by kenny.hanson is still ongoing after 1.5 years. If the RStudio desktop locks and close your browser and use the Connect to RStudio button again, it tacks on appUri to the end of the URL.
Example: https://tempest-web.msu.montana.edu/rnode/tempest-epyc001/43729/appUri
This gives you a Page Not Found error.
You have to delete the appUri at the end of the URL
https://tempest-web.msu.montana.edu/rnode/tempest-epyc001/43729
This reconnects your session.
Kenny
Hey, nice to see you at the GOOD conference and sorry for the delay.
This is a bit of a dodge, but I think we had this at OSC too. We set the session timeout to 0 so it never times out to just circumvent the issue altogether.
No idea where the static string appUri
is coming from. Can you share your view.html.erb
?
Hi Jeff, No worries. That conference was fun
Good to see you guys too.
I don’t see where you guys read the config in etc/rsession.conf.erb
I try to set the session timeout also using script.sh.erb but it doesn’t seem to work this way. I’m running a test right now to verify. No trouble when the session locks and I haven’t closed the browser tab. It’s when you close the tab and go back to your session and auth using the pw in connection.yml, then click connect.
Disable session timeout, causes problems when idle for too long
export RSESSION_CONF=“${PWD}/rsession.conf”
(
umask 077
echo “# R Session Configuration File”
echo “session-timeout-minutes=0”
) > “${RSESSION_CONF}”
chmod 700 “${RSESSION_CONF}”
…
rserver
–www-port ${port}
–auth-none 0
–auth-pam-helper-path “${RSTUDIO_AUTH}”
–auth-encrypt-password 0
–rsession-path “${RSESSION_WRAPPER_FILE}”
–rsession-config-file “${RSESSION_CONF}”
–server-data-dir “${TMPDIR}”
–secure-cookie-key-file “${TMPDIR}/rstudio-server/secure-cookie-key”
–database-config-file “${DBCONF}”
–server-user $(whoami)
Here’s view.html.erb:
(I removed all the < as this nice forum was trying to run the script)
script>
document.cookie = “csrf-token=<%= csrf_token %>; path=/rnode/<%= host %>/<%= port %>; secure”;
/script>
form action=“/rnode/<%= host %>/<%= port %>/auth-do-sign-in” method=“post” target=“_blank”>
input type=“hidden” name=“username” value=“<%= ENV[“USER”] %>”>
input type=“hidden” name=“password” value=“<%= password %>”>
input type=“hidden” name=“staySignedIn” value=“1”>
input type=“hidden” name=“appUri” value=“”>
input type=“hidden” name=“csrf-token” value=“<%= csrf_token %>”/>
button class=“btn btn-primary” type=“submit”>
i class=“fa fa-registered”> Connect to RStudio Server
/button>
/form>
Kenny
Well I’d guess appUri is coming from this. If I look at the git blame on our app, this addition is 8 years old and a part of the first commit to this file, so I have no idea why it’s there and/or what it does.
Here’s the steps. My rsession.conf has been ignored for some reason, the RStudio session locked from inactivity. So I close that [Chrome] browser tab and go to my session card.
I click on Connect and it opens new browser tab. Notice the URL already has appUri=appUri
I enter the password from connection.yml, click “Sign In” and it opens this:
Notice appUri at the end of the URL. Delete that and RStudio session resumes.
Kenny
Maybe try setting the value="/"
? Seems like a red-herring either way, like not the root cause of the issue but secondary.
I’m wondering why my rsession.conf is being ignored also, I clearly include it in the rserver call. How are you guys calling yours in the repo you posted?
Because we use bubblewrap we’re able to mount in a new directory into /etc/rstudio
. so that’s how we do it chroot
mounts basically.
It’s odd that it’s not recognizing that file - can you pull any logs that may indicate why? Could be something as simple as a formatting issue.
I wish RStudio was a bit friendlier in displaying the active configuration.
It’s obviously loading the rsession.conf file. How can I test what the variable is set to within RStudio IDE workspace?
exec rsession --r-libs-user ‘’ --log-stderr 1 --config-file /home/w55c785/ondemand/data/sys/dashboard/batch_connect/sys/rstudio/output/797416fd-fa4e-471d-9f28-4f97073f3fdc/rsession.conf -u w55c785 --session-use-secure-cookies 1 --session-root-path / --session-same-site 0 --session-use-file-storage 1 --launcher-token D23C1BD5 --r-restore-workspace 2 --r-run-rprofile 2
At a glance, I don’t know if you can. All the help menus around options are not the server options but the users’ own preferences.
Maybe under the hood it’s merging that conf and the one from /etc choosing to prioritize /etc over the cli argument?
It’s strange, it worked for like a year then one day it just stopped 
My test fails, the IDE is locked after 60 minutes which I think is default. It must be ignoring the rsession.conf we added to the config.
Running a test overnight, I’ll post again tomorrow.
K