jupyterhub / jupyter-rsession-proxy

Jupyter extensions for running an RStudio rsession proxy
BSD 3-Clause "New" or "Revised" License
118 stars 87 forks source link

Getting jupyter-rsession-proxy working with RStudio 1.3.1056 #93

Closed riazarbi closed 3 years ago

riazarbi commented 4 years ago

Bug description

This jupyter add-on works with RStudio 1.2. I am not able to make it work with RStudio 1.3.

Expected behaviour

I expect Rstudio to appear at the /rstudio subpath of my jupyter server url.

Actual behaviour

I get the following error in my terminal when navigating to the subpath where RStudio should be -

20 Jul 2020 13:21:05 [rserver] ERROR system error 1 (Operation not permitted) [path: /var/run/rstudio-server/revocation-list, description: Could not set revocation file permissions to 600 for file: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::system::changeFileMode(const rstudio::core::FilePath&, mode_t) src/cpp/server/ServerMain.cpp:62; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:531

The webUI displays the following page -

image

How to reproduce

Replace

ENV RSTUDIO_VERSION 1.2.5001

with

ENV RSTUDIO_VERSION 1.3.1056

in the Dockerfile in

https://github.com/riazarbi/datasci-gui-minimal

Build and launch, navigate to https://localhost:8888/rstudio

Your personal set up

My Dockerfile, which works with RStudio 1.2, is here -

https://github.com/riazarbi/datasci-gui-minimal/blob/master/Dockerfile

It's based on Ubuntu focal (20.04).

ryanlovett commented 4 years ago

When I run this on jupyter/minimal-notebook (Ubuntu Bionic), I am also unable to launch RStudio. However I get the following which is RStudio's error screen, and not Jupyter's: Screen Shot 2020-07-20 at 4 48 07 PM

This also happens when I bypass jupyter-rsession-proxy altogether, either by manually running rserver or rsession, manually invoking the same options and setting the environment in __init__.py. In other words, I'm connecting directly to the rserver or rsession instance and not using jupyter at all.

vnijs commented 4 years ago

I believe Rstudio is not quite compatible with Ubuntu 20.04. See list of support OS-es: https://rstudio.com/about/platform-support/

ryanlovett commented 4 years ago

I was developing in a container but backtracked to working on a real system with the rstudio-server service running on port 8787. I wanted to make sure I wasn't introducing the issue via the conventional way we run the program. I also wasn't able to start a session there, but that instance logged errors to syslog:

ERROR r error 4 (R code execution error) [errormsg: Error in base::library("package", ...) : #012  there is no package called ‘package’#012]; OCCURRED AT rstudio::core::Error rstudio::r::exec::evaluateString(const string&, SEXPREC**, rstudio::r::sexp::Protect*) src/cpp/r/RExec.cpp:314#012; LOGGED FROM: void {anonymous}::rSuicide(const string&) src/cpp/session/SessionMain.cpp:1148

So it was failing due to a missing package called "package". I couldn't find a CRAN package named "package" so I made my own dummy package "package" and installed it. That fixed the standalone rstudio-server daemon, and also my container running on a completely different machine with jupyter and jupyter-rsession-proxy when I installed it there too.

So if this isn't a weird inherited environment issue of some sort, it seems like there's a bug in rstudio-server or its dependencies/packaging. Can anyone else reproduce the error and fix?

Here is the working Dockerfile:

FROM jupyter/minimal-notebook

USER root

RUN apt-get update -qq && \
    apt-get install -y --no-install-recommends \
    software-properties-common \
    gdebi-core \
    dirmngr \
    gpg-agent \
    strace \
    lsof \
    less

RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
RUN add-apt-repository -y 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/'

RUN apt-get update -qq -y && \
    apt install -y r-base r-base-core r-recommended

#ENV RSTUDIO_VERSION 1.2.1335
ENV RSTUDIO_VERSION 1.3.1056

RUN wget --quiet https://download2.rstudio.org/server/bionic/amd64/rstudio-server-${RSTUDIO_VERSION}-amd64.deb
RUN gdebi -n rstudio-server-${RSTUDIO_VERSION}-amd64.deb

USER $NB_USER
RUN pip install jupyter-rsession-proxy
RUN jupyter labextension install @jupyterlab/server-proxy

USER root
ADD package /tmp/package
RUN cd /tmp && R CMD INSTALL package

USER jovyan
ENV PATH="${PATH}:/usr/lib/rstudio-server/bin"

CMD jupyter notebook --ip=0.0.0.0 --port=8888 --NotebookApp.token=
vnijs commented 4 years ago

I didn't see this error but did have to (1) use 'focal-cran40' and (2) remove the section on 'package'.

RUN add-apt-repository -y 'deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/'

edergillian commented 4 years ago

@ryanlovett , I was able to reproduce the error using your working Dockerfile, except for the 'package' section. I also had to use focal-cran40, as the new Jupyter images are all Focal Fossa.

I will try to create the dummy package and see if I can get it to work.

EDIT: installed a dummy package, as you instructed, and can confirm it works!

vnijs commented 3 years ago

I think this might be issue (https://github.com/rstudio/rstudio/issues/7575). Which is an issue listed as fixed in the 1.3.1081 preview version (https://rstudio.com/products/rstudio/download/preview-release-notes/). I have been trying out the 1.3.1081 preview version of Rstudio with docker but now get a 404: Not Found when launching from JupyterLab.

FROM jupyter/minimal-notebook

USER root

RUN apt-get update -qq && \
    apt-get install -y --no-install-recommends \
        software-properties-common \
        gdebi-core \
        dirmngr \
        gpg-agent \
        strace \
        lsof \
        less

RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
RUN add-apt-repository -y 'deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/'

RUN apt-get update -qq -y && \
    apt install -y r-base r-base-core r-recommended

# ENV RSTUDIO_VERSION 1.2.1335
# ENV RSTUDIO_VERSION 1.3.1056
ENV RSTUDIO_VERSION 1.3.1081

RUN wget https://s3.amazonaws.com/rstudio-ide-build/server/bionic/amd64/rstudio-server-${RSTUDIO_VERSION}-amd64.deb \
  && gdebi -n rstudio-server-${RSTUDIO_VERSION}-amd64.deb \
  && rm rstudio-server-*-amd64.deb

USER $NB_USER
RUN pip install jupyter-rsession-proxy
RUN jupyter labextension install @jupyterlab/server-proxy

# USER root
# ADD package /tmp/package
# RUN cd /tmp && R CMD INSTALL package

USER jovyan
ENV PATH="${PATH}:/usr/lib/rstudio-server/bin"

CMD jupyter notebook --ip=0.0.0.0 --port=8888 --NotebookApp.token=
riazarbi commented 3 years ago

I just built a docker image with ENV RSTUDIO_VERSION 1.3.1093 and I got a 500 error: could not start rstudio in time.

The Dockerfile is here - https://github.com/riazarbi/datasci-gui-minimal/blob/rstudio-1.3/Dockerfile

Note that I'm using Ubuntu focal. Focal does work with Rstudio server 1.2.5001.

Here are the console logs:

[C 08:35:33.413 LabApp] 

    To access the notebook, open this file in a browser:
        file:///home/jovyan/.local/share/jupyter/runtime/nbserver-15-open.html
    Or copy and paste one of these URLs:
        http://9c8476b3656e:8888/?token=4e63d07f725dedfdb952cd9e89d83ac48dc0a8041d87f6aa
     or http://127.0.0.1:8888/?token=4e63d07f725dedfdb952cd9e89d83ac48dc0a8041d87f6aa
[I 08:36:18.479 LabApp] 302 GET /?token=4e63d07f725dedfdb952cd9e89d83ac48dc0a8041d87f6aa (192.168.101.199) 2.42ms
[I 08:36:18.494 LabApp] 302 GET /rstudio?token=4e63d07f725dedfdb952cd9e89d83ac48dc0a8041d87f6aa (192.168.101.199) 0.82ms
12 Nov 2020 06:36:18 [rserver] ERROR system error 1 (Operation not permitted) [path: /var/run/rstudio-server/revocation-list, description: Could not set revocation file permissions to 600 for file: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::system::changeFileMode(const rstudio::core::FilePath&, mode_t) src/cpp/server/ServerMain.cpp:62; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:530
12 Nov 2020 06:36:18 [rserver] ERROR Could not read revocation list; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:538
12 Nov 2020 06:36:18 [rserver] ERROR system error 2 (No such file or directory) [path: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::FilePath::openForRead(std::shared_ptr<std::basic_istream<char> >&) const src/cpp/shared_core/FilePath.cpp:1167; LOGGED FROM: int main(int, char* const*) src/cpp/server/ServerMain.cpp:674
12 Nov 2020 06:36:19 [rserver] ERROR system error 1 (Operation not permitted) [path: /var/run/rstudio-server/revocation-list, description: Could not set revocation file permissions to 600 for file: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::system::changeFileMode(const rstudio::core::FilePath&, mode_t) src/cpp/server/ServerMain.cpp:62; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:530
12 Nov 2020 06:36:19 [rserver] ERROR Could not read revocation list; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:538
12 Nov 2020 06:36:19 [rserver] ERROR system error 2 (No such file or directory) [path: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::FilePath::openForRead(std::shared_ptr<std::basic_istream<char> >&) const src/cpp/shared_core/FilePath.cpp:1167; LOGGED FROM: int main(int, char* const*) src/cpp/server/ServerMain.cpp:674
12 Nov 2020 06:36:19 [rserver] ERROR system error 1 (Operation not permitted) [path: /var/run/rstudio-server/revocation-list, description: Could not set revocation file permissions to 600 for file: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::system::changeFileMode(const rstudio::core::FilePath&, mode_t) src/cpp/server/ServerMain.cpp:62; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:530
12 Nov 2020 06:36:19 [rserver] ERROR Could not read revocation list; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:538
12 Nov 2020 06:36:19 [rserver] ERROR system error 2 (No such file or directory) [path: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::FilePath::openForRead(std::shared_ptr<std::basic_istream<char> >&) const src/cpp/shared_core/FilePath.cpp:1167; LOGGED FROM: int main(int, char* const*) src/cpp/server/ServerMain.cpp:674
12 Nov 2020 06:36:19 [rserver] ERROR system error 1 (Operation not permitted) [path: /var/run/rstudio-server/revocation-list, description: Could not set revocation file permissions to 600 for file: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::system::changeFileMode(const rstudio::core::FilePath&, mode_t) src/cpp/server/ServerMain.cpp:62; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:530
12 Nov 2020 06:36:19 [rserver] ERROR Could not read revocation list; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:538
12 Nov 2020 06:36:19 [rserver] ERROR system error 2 (No such file or directory) [path: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::FilePath::openForRead(std::shared_ptr<std::basic_istream<char> >&) const src/cpp/shared_core/FilePath.cpp:1167; LOGGED FROM: int main(int, char* const*) src/cpp/server/ServerMain.cpp:674
12 Nov 2020 06:36:19 [rserver] ERROR system error 1 (Operation not permitted) [path: /var/run/rstudio-server/revocation-list, description: Could not set revocation file permissions to 600 for file: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::system::changeFileMode(const rstudio::core::FilePath&, mode_t) src/cpp/server/ServerMain.cpp:62; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:530
12 Nov 2020 06:36:19 [rserver] ERROR Could not read revocation list; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:538
12 Nov 2020 06:36:19 [rserver] ERROR system error 2 (No such file or directory) [path: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::FilePath::openForRead(std::shared_ptr<std::basic_istream<char> >&) const src/cpp/shared_core/FilePath.cpp:1167; LOGGED FROM: int main(int, char* const*) src/cpp/server/ServerMain.cpp:674
12 Nov 2020 06:36:20 [rserver] ERROR system error 1 (Operation not permitted) [path: /var/run/rstudio-server/revocation-list, description: Could not set revocation file permissions to 600 for file: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::system::changeFileMode(const rstudio::core::FilePath&, mode_t) src/cpp/server/ServerMain.cpp:62; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:530
12 Nov 2020 06:36:20 [rserver] ERROR Could not read revocation list; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:538
12 Nov 2020 06:36:20 [rserver] ERROR system error 2 (No such file or directory) [path: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::FilePath::openForRead(std::shared_ptr<std::basic_istream<char> >&) const src/cpp/shared_core/FilePath.cpp:1167; LOGGED FROM: int main(int, char* const*) src/cpp/server/ServerMain.cpp:674
12 Nov 2020 06:36:20 [rserver] ERROR system error 1 (Operation not permitted) [path: /var/run/rstudio-server/revocation-list, description: Could not set revocation file permissions to 600 for file: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::system::changeFileMode(const rstudio::core::FilePath&, mode_t) src/cpp/server/ServerMain.cpp:62; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:530
12 Nov 2020 06:36:20 [rserver] ERROR Could not read revocation list; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:538
12 Nov 2020 06:36:20 [rserver] ERROR system error 2 (No such file or directory) [path: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::FilePath::openForRead(std::shared_ptr<std::basic_istream<char> >&) const src/cpp/shared_core/FilePath.cpp:1167; LOGGED FROM: int main(int, char* const*) src/cpp/server/ServerMain.cpp:674
12 Nov 2020 06:36:20 [rserver] ERROR system error 1 (Operation not permitted) [path: /var/run/rstudio-server/revocation-list, description: Could not set revocation file permissions to 600 for file: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::system::changeFileMode(const rstudio::core::FilePath&, mode_t) src/cpp/server/ServerMain.cpp:62; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:530
12 Nov 2020 06:36:20 [rserver] ERROR Could not read revocation list; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:538
12 Nov 2020 06:36:20 [rserver] ERROR system error 2 (No such file or directory) [path: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::FilePath::openForRead(std::shared_ptr<std::basic_istream<char> >&) const src/cpp/shared_core/FilePath.cpp:1167; LOGGED FROM: int main(int, char* const*) src/cpp/server/ServerMain.cpp:674
12 Nov 2020 06:36:20 [rserver] ERROR system error 1 (Operation not permitted) [path: /var/run/rstudio-server/revocation-list, description: Could not set revocation file permissions to 600 for file: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::system::changeFileMode(const rstudio::core::FilePath&, mode_t) src/cpp/server/ServerMain.cpp:62; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:530
12 Nov 2020 06:36:20 [rserver] ERROR Could not read revocation list; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:538
12 Nov 2020 06:36:20 [rserver] ERROR system error 2 (No such file or directory) [path: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::FilePath::openForRead(std::shared_ptr<std::basic_istream<char> >&) const src/cpp/shared_core/FilePath.cpp:1167; LOGGED FROM: int main(int, char* const*) src/cpp/server/ServerMain.cpp:674
12 Nov 2020 06:36:21 [rserver] ERROR system error 1 (Operation not permitted) [path: /var/run/rstudio-server/revocation-list, description: Could not set revocation file permissions to 600 for file: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::system::changeFileMode(const rstudio::core::FilePath&, mode_t) src/cpp/server/ServerMain.cpp:62; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:530
12 Nov 2020 06:36:21 [rserver] ERROR Could not read revocation list; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:538
12 Nov 2020 06:36:21 [rserver] ERROR system error 2 (No such file or directory) [path: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::FilePath::openForRead(std::shared_ptr<std::basic_istream<char> >&) const src/cpp/shared_core/FilePath.cpp:1167; LOGGED FROM: int main(int, char* const*) src/cpp/server/ServerMain.cpp:674
12 Nov 2020 06:36:21 [rserver] ERROR system error 1 (Operation not permitted) [path: /var/run/rstudio-server/revocation-list, description: Could not set revocation file permissions to 600 for file: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::system::changeFileMode(const rstudio::core::FilePath&, mode_t) src/cpp/server/ServerMain.cpp:62; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:530
12 Nov 2020 06:36:21 [rserver] ERROR Could not read revocation list; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:538
12 Nov 2020 06:36:21 [rserver] ERROR system error 2 (No such file or directory) [path: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::FilePath::openForRead(std::shared_ptr<std::basic_istream<char> >&) const src/cpp/shared_core/FilePath.cpp:1167; LOGGED FROM: int main(int, char* const*) src/cpp/server/ServerMain.cpp:674
12 Nov 2020 06:36:21 [rserver] ERROR system error 1 (Operation not permitted) [path: /var/run/rstudio-server/revocation-list, description: Could not set revocation file permissions to 600 for file: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::system::changeFileMode(const rstudio::core::FilePath&, mode_t) src/cpp/server/ServerMain.cpp:62; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:530
12 Nov 2020 06:36:21 [rserver] ERROR Could not read revocation list; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:538
12 Nov 2020 06:36:21 [rserver] ERROR system error 2 (No such file or directory) [path: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::FilePath::openForRead(std::shared_ptr<std::basic_istream<char> >&) const src/cpp/shared_core/FilePath.cpp:1167; LOGGED FROM: int main(int, char* const*) src/cpp/server/ServerMain.cpp:674
12 Nov 2020 06:36:22 [rserver] ERROR system error 1 (Operation not permitted) [path: /var/run/rstudio-server/revocation-list, description: Could not set revocation file permissions to 600 for file: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::system::changeFileMode(const rstudio::core::FilePath&, mode_t) src/cpp/server/ServerMain.cpp:62; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:530
12 Nov 2020 06:36:22 [rserver] ERROR Could not read revocation list; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:538
12 Nov 2020 06:36:22 [rserver] ERROR system error 2 (No such file or directory) [path: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::FilePath::openForRead(std::shared_ptr<std::basic_istream<char> >&) const src/cpp/shared_core/FilePath.cpp:1167; LOGGED FROM: int main(int, char* const*) src/cpp/server/ServerMain.cpp:674
12 Nov 2020 06:36:22 [rserver] ERROR system error 1 (Operation not permitted) [path: /var/run/rstudio-server/revocation-list, description: Could not set revocation file permissions to 600 for file: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::system::changeFileMode(const rstudio::core::FilePath&, mode_t) src/cpp/server/ServerMain.cpp:62; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:530
12 Nov 2020 06:36:22 [rserver] ERROR Could not read revocation list; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:538
12 Nov 2020 06:36:22 [rserver] ERROR system error 2 (No such file or directory) [path: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::FilePath::openForRead(std::shared_ptr<std::basic_istream<char> >&) const src/cpp/shared_core/FilePath.cpp:1167; LOGGED FROM: int main(int, char* const*) src/cpp/server/ServerMain.cpp:674
12 Nov 2020 06:36:22 [rserver] ERROR system error 1 (Operation not permitted) [path: /var/run/rstudio-server/revocation-list, description: Could not set revocation file permissions to 600 for file: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::system::changeFileMode(const rstudio::core::FilePath&, mode_t) src/cpp/server/ServerMain.cpp:62; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:530
12 Nov 2020 06:36:22 [rserver] ERROR Could not read revocation list; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:538
12 Nov 2020 06:36:22 [rserver] ERROR system error 2 (No such file or directory) [path: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::FilePath::openForRead(std::shared_ptr<std::basic_istream<char> >&) const src/cpp/shared_core/FilePath.cpp:1167; LOGGED FROM: int main(int, char* const*) src/cpp/server/ServerMain.cpp:674
12 Nov 2020 06:36:22 [rserver] ERROR system error 1 (Operation not permitted) [path: /var/run/rstudio-server/revocation-list, description: Could not set revocation file permissions to 600 for file: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::system::changeFileMode(const rstudio::core::FilePath&, mode_t) src/cpp/server/ServerMain.cpp:62; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:530
12 Nov 2020 06:36:22 [rserver] ERROR Could not read revocation list; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:538
12 Nov 2020 06:36:22 [rserver] ERROR system error 2 (No such file or directory) [path: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::FilePath::openForRead(std::shared_ptr<std::basic_istream<char> >&) const src/cpp/shared_core/FilePath.cpp:1167; LOGGED FROM: int main(int, char* const*) src/cpp/server/ServerMain.cpp:674
12 Nov 2020 06:36:23 [rserver] ERROR system error 1 (Operation not permitted) [path: /var/run/rstudio-server/revocation-list, description: Could not set revocation file permissions to 600 for file: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::system::changeFileMode(const rstudio::core::FilePath&, mode_t) src/cpp/server/ServerMain.cpp:62; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:530
12 Nov 2020 06:36:23 [rserver] ERROR Could not read revocation list; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:538
12 Nov 2020 06:36:23 [rserver] ERROR system error 2 (No such file or directory) [path: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::FilePath::openForRead(std::shared_ptr<std::basic_istream<char> >&) const src/cpp/shared_core/FilePath.cpp:1167; LOGGED FROM: int main(int, char* const*) src/cpp/server/ServerMain.cpp:674
12 Nov 2020 06:36:23 [rserver] ERROR system error 1 (Operation not permitted) [path: /var/run/rstudio-server/revocation-list, description: Could not set revocation file permissions to 600 for file: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::system::changeFileMode(const rstudio::core::FilePath&, mode_t) src/cpp/server/ServerMain.cpp:62; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:530
12 Nov 2020 06:36:23 [rserver] ERROR Could not read revocation list; LOGGED FROM: rstudio::core::Error rstudio::server::auth::handler::initialize() src/cpp/server/auth/ServerAuthHandler.cpp:538
12 Nov 2020 06:36:23 [rserver] ERROR system error 2 (No such file or directory) [path: /var/run/rstudio-server/revocation-list]; OCCURRED AT rstudio::core::Error rstudio::core::FilePath::openForRead(std::shared_ptr<std::basic_istream<char> >&) const src/cpp/shared_core/FilePath.cpp:1167; LOGGED FROM: int main(int, char* const*) src/cpp/server/ServerMain.cpp:674
[W 08:36:23.586 LabApp] 500 GET /rstudio/?token=4e63d07f725dedfdb952cd9e89d83ac48dc0a8041d87f6aa (192.168.101.199): could not start rstudio in time
[E 08:36:23.608 LabApp] {
      "Host": "server:8888",
      "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:82.0) Gecko/20100101 Firefox/82.0",
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
      "Accept-Language": "en-US,en;q=0.5",
      "Accept-Encoding": "gzip, deflate",
      "Connection": "keep-alive",
      "Cookie": "username-server-8888=\"2|1:0|10:1605162978|20:username-server-8888|44:Yjk1ZTI1N2E2Y2UzNGRjNzg5NTcxMWNmNzYyNjg3Mjk=|5ddba93a50f86ee049514773e647b28cba9ac794c218ab4ae0ea5c09b45e79f8\"; _xsrf=2|ed1e89d1|d0563c62d02248dd8c3a519bbdc60ab2|1605162820",
      "Upgrade-Insecure-Requests": "1"
    }
[E 08:36:23.608 LabApp] 500 GET /rstudio/?token=4e63d07f725dedfdb952cd9e89d83ac48dc0a8041d87f6aa (192.168.101.199) 5096.88ms referer=None
vnijs commented 3 years ago

The last version of Rstudio that works with jupyter-rsession-proxy is 1.3.959. See https://github.com/jupyterhub/jupyter-rsession-proxy/issues/95 for discussion on coming up with a fix

riazarbi commented 3 years ago

@vnijs - ok, RStudio v1.2 is now unable to render plots as of R v4.1.0, so I'm motivated to at least get my docker image up to v1.3.

Do you have a working Dockerfile that uses v1.3 with the jupyter-rsession-proxy I can reference?

riazarbi commented 3 years ago

Closing the loop on this, I've managed to get Rstudio 1.39 working with jupyter-rsesison proxy. The solution was as follows -


The "auth revocation list" in the rstudio server needs to be writeable with 600 permissions and under a directory controlled by the user running rserver. Otherwise rserver exits and you get the internal server error.

I saw this when I tried to go to my jupyter notebook, opened a terminal and ran the /usr/lib/rstudio-server/bin/rserver command, trying with and without sudo, and checking the directories mentioned there.

This solved the issue for me:

RUN echo "auth-revocation-list-dir=/tmp/rstudio-server-revocation-list/" >> /etc/rstudio/rserver.conf

I guess something similar may work for you.

I took the idea from https://github.com/rstudio/rstudio/commit/1678627fd8649d11b8db0017bac35ddcc2ea31e5

Originally posted by @zeehio in https://github.com/jupyterhub/jupyter-rsession-proxy/issues/91#issuecomment-650196562

riazarbi commented 3 years ago

Why I'm reopening the issue

Unfortunately, RStudio v 1.3.9 is also incompatible with the R graphics engine 14, which is the graphics version which ships with R 4.1.0.

R 4.1.0 is, at the moment, the current version that ships with apt-get on Ubuntu focal.

Browsing the RStudio release notes, it looks like the first release that supports the R graphics engine 14 is v 1.3.10.

So, this issue is still valid.

What I'm going to try next

Browsing the Rstudio Server release notes, it looks like the 1.4.1722 preview release fixed the header-forwarding issue.

https://www.rstudio.com/products/rstudio/download/preview-release-notes/

So I'm going to add the ENV RSESSION_PROXY_RSTUDIO_1_4=yes variable to my Dockerfile, build with

https://s3.amazonaws.com/rstudio-ide-build/server/bionic/amd64/rstudio-server-1.4.1722-amd64.deb

and see if it works.

riazarbi commented 3 years ago

Ok, feedback.

Using:

ENV RSTUDIO_VERSION=1.4.1722
#https://s3.amazonaws.com/rstudio-ide-build/server/bionic/amd64/rstudio-server-1.4.1722-amd64.deb
ENV RSESSION_PROXY_RSTUDIO_1_4=yes

I get the following error in my browser -

404 page not found

The url in the url bar is

https://datascience.capetown.gov.za/auth-sign-in?appUri=%2F

It should be (if working correctly)

https://datascience.capetown.gov.za/workbench/user/rarbi/rstudio/

My notebook container logs give the following -

[I 2021-06-24 15:23:57.267 SingleUserNotebookApp log:189] 302 GET /workbench/user/rarbi/rstudio/ -> /auth-sign-in?appUri=%2F (rarbi@10.42.7.1) 809.02ms

Next I'll try it without the ENV RSESSION_PROXY_RSTUDIO_1_4=yes flag

riazarbi commented 3 years ago

Ok, If I run without the RSESSION_PROXY_RSTUDIO_1_4 flag, I get a 500 error: could not start rstudio in time.

My container logs look like this -

[W 2021-06-24 16:45:40.772 SingleUserNotebookApp web:1787] 500 GET /workbench/user/rarbi/rstudio/ (10.42.7.1): could not start rstudio in time
[E 2021-06-24 16:45:40.782 SingleUserNotebookApp log:181] {
      "X-Real-Ip": "10.42.7.1",
      "X-Forwarded-Server": "traefik-ingress-controller-6d48866bf8-9ntbf",
      "X-Forwarded-Proto": "https,http",
      "X-Forwarded-Port": "443,80",
      "X-Forwarded-Host": "datascience.capetown.gov.za",
      "X-Forwarded-For": "10.42.7.1,::ffff:10.42.7.65",
      "Upgrade-Insecure-Requests": "1",
      "Te": "trailers",
      "Referer": "https://datascience.capetown.gov.za/workbench/user/rarbi/lab",
      "Cookie": "port-token=[secret]; jupyterhub-user-rarbi=[secret]; _ga=[secret]; _xsrf=[secret]; auth_tkt=[secret]; csrf-token=[secret]; jupyterhub-session-id=[secret]; user-id=[secret]; user-list-id=[secret]",
      "Accept-Language": "en-US,en;q=0.5",
      "Accept-Encoding": "gzip, deflate, br",
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
      "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0",
      "Host": "datascience.capetown.gov.za",
      "Connection": "close"
    }
[E 2021-06-24 16:45:40.782 SingleUserNotebookApp log:189] 500 GET /workbench/user/rarbi/rstudio/ (rarbi@10.42.7.1) 5072.73ms

Does anybody have any pointers at this point? I feel like we're very close to cracking v 1.4 with jupyterhub.

Perhaps I need to keep the RSESSION_PROXY_RSTUDIO_1_4 flag and then somehow set a root url path or something. @ryanlovett , @vnijs , @cboettig?

riazarbi commented 3 years ago

I've followed the conversation here https://github.com/jupyterhub/jupyter-rsession-proxy/issues/95 and the merge request here https://github.com/jupyterhub/jupyter-rsession-proxy/pull/96 and I'm reasonably convinced that I'm just reinventing the wheel.

Here is where things stand as far as my build is concerned.

I'm using the flag RSESSION_PROXY_RSTUDIO_1_4 only. I'm using the RStudio server preview release 1.4.1722.

The release notes for that version are as follows -

 “Trampled Dandelion”, June 22nd, 2021    
- Removed the breaking change introduced in Juliet Rose that changed the behavior of the X-Forwarded-Proto header when RSW is behind a proxy server
-  Fixed an issue where RStudio Desktop Pro could fail when connecting to remote sessions via https (Pro #2651)

This leads me to believe that, with the right settings, we should be able to get 1.4 working with this proxy.

If I navigate to /rstudio by clicking the launcher button in /lab/ I am redirected to the correct place - namely

https://datascience.capetown.gov.za/workbench/user/rarbi/rstudio/

however, rstudio then redirects me to

https://datascience.capetown.gov.za/auth-sign-in?appUri=%2F

If I go to the url directly -

https://datascience.capetown.gov.za/workbench/user/rarbi/rstudio/auth-sign-in?appUri=%2F

Then all is well and Rstudio initializes, and subsequent visits for that session work fine.

That's the situation currently, perhaps it'll help someone working on the issue.

zeehio commented 3 years ago

Thank you for systematically recording all the details of your test and for finding the solution, even if right now it leads to an RStudio bug.

Since this is an rstudio bug and has been reported upstream, I am not sure if anyone will be able to workaround it here. It looks to me like RStudio may be considering now this an RStudio Workbench (before RStudio Server Pro) feature and it does not seem a high priority for them to fix it in RStudio Server.

To my understanding, the easiest way to solve this without patching RStudio Server is to add a reverse proxy between the Jupyterhub proxy and RStudio able to inspect and fix the wrong response in the RStudio redirection before it hits the user's browser.

dhirschfeld commented 3 years ago

The problem with the incorrect redirect (even when --www-root-path is set) is being tracked in https://github.com/jupyterhub/jupyter-rsession-proxy/issues/97

zeehio commented 3 years ago

I found a workaround to the rstudio bug, by changing the jupyter frontend so the link to RStudio directly points to the right /auth-sign-in page. RStudio then works successfully. I would not have been able to do it without @riazarbi explanations.

Current limitations:

imagen