Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"No user specified" error with Rstudio 1.2.1335 #65

Open
anton-khodak opened this issue Apr 23, 2019 · 12 comments
Open

"No user specified" error with Rstudio 1.2.1335 #65

anton-khodak opened this issue Apr 23, 2019 · 12 comments

Comments

@anton-khodak
Copy link
Contributor

Hi,

I'm using jupyter-rsession-proxy inside zero-to-jupyterhub Kubernetes deployment. For Rstudio version == 1.2.1335 R code is executed in console, but launching any R code from the editor ends with an error:

[rsession-] ERROR system error 13 (Permission denied) [description=No user specified]; OCCURRED AT: rstudio::core::Error rstudio::server_core::sessions::signRequest(const string&, rstudio::core::http::Request&, bool) /var/lib/jenkins/workspace/IDE_open-source-pipeline_v1.2/src/cpp/server_core/sessions/SessionSignature.cpp:42; LOGGED FROM: void rstudio::session::modules::rmarkdown::notebook::{anonymous}::NotebookQueue::consoleThreadMain() /var/lib/jenkins/workspace/IDE_open-source-pipeline_v1.2/src/cpp/session/modules/rmarkdown/NotebookQueue.cpp:498

It works as expected with RStudio == 1.1.456. I suspect it has something to deal with how rsession-proxy specifies a user when starting Rstudio.

@zeehio
Copy link

zeehio commented May 14, 2019

RStudio 1.2.1335 requires a header "X-RStudioUserIdentity" with the username, according to https://github.com/rstudio/rstudio/blame/8af730409bb6d651cc8f6816d136bea91441e7a4/src/cpp/server_core/sessions/SessionSignature.cpp#L30-L43

(I wish I knew how to pass this header from the jupyterhub rsession proxy)

@ryanlovett
Copy link
Collaborator

I believe overriding proxy_request_headers will work here. If nobody gets to this before me I'll try to work on it next week.

A better solution would be to make this independent of the http client we happen to be using now.

@ryanlovett
Copy link
Collaborator

I've prepared a fix for this which involves letting jupyter-server-proxy users specify additional headers. However I then tried to reproduce this issue without the fix and was unable to do so. I was able to execute commands from Console and by hitting Run from within an editor. Do you have some tips on how to reproduce?

Here is the container I was testing from which uses jupyter-server-proxy master and jupyter-rsession-proxy master:

FROM jupyter/minimal-notebook

USER root

RUN apt-get update
RUN apt-get install -y --no-install-recommends r-base gdebi-core

# ENV RSTUDIO_VERSION 1.1.456
ENV RSTUDIO_VERSION 1.2.1335

# RUN wget --quiet https://download2.rstudio.org/rstudio-server-${RSTUDIO_VERSION}-amd64.deb
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
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

USER $NB_USER

RUN pip install git+https://github.com/jupyterhub/jupyter-server-proxy
# RUN pip install git+https://github.com/ryanlovett/jupyter-server-proxy@configurable_headers
RUN pip install git+https://github.com/jupyterhub/jupyter-rsession-proxy

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

Iirc there's another server extension which wants the additional headers feature so I'll work on it regardless.

@zeehio
Copy link

zeehio commented May 22, 2019

Thanks! I'll test as soon as I can, hopefully this week or the next one. I will try to provide a small reproducible environment as well.

With respect to the reproducible environment, it is a bit confusing to me that the latest jupyter-rsesion-proxy version on pypi is (apparently?) not merged #57 ... Do you know why?

@ryanlovett
Copy link
Collaborator

Not sure why that PR hasn't merged yet. Maybe its worthwhile to post a message on that issue?

Fwiw, I tried using the desktop version of rstudio rather than rstudio-server in the same Dockerfile as above and it also ran fine.

@zeehio
Copy link

zeehio commented May 23, 2019

I am puzzled since I can't reproduce the error anymore. Maybe @anton-khodak can?

On the other hand, I realized I was getting all sorts of errors from RStudio due to
a) Wrong permissions on the /home/$user/.rstudio directory
b) Multiple RStudio servers using simultaneously the same /home/$user/.rstudio directory

So maybe the "No user specified" error was actually related to that and I fixed it. RStudio is working fine now for me as well with the current pypi versions.

In case Anton can reproduce the issue, maybe he can also check if it is solved by setting proper permissions in his rstudio directory.

To address a), I created this script:

#!/bin/sh
# Name it fix-rstudio.sh and place it with your notebook Dockerfile

chown -R ${NB_UID}:${NB_GID} /home/${NB_USER}/.rstudio

And add it to the before-notebook.d hooks in the notebook Dockerfile:

COPY fix-rstudio.sh /usr/local/bin/before-notebook.d/fix-rstudio.sh

To address b), I made sure the /home/${NB_USER}/.rstudio was not shared among multiple rstudio instances.

@anton-khodak
Copy link
Contributor Author

Sorry for taking so long to answer. A reproducible example would be to use @ryanlovett 's Dockerfile and to try running a chunk in a file with a name "test.Rmd" and content

    ```{r}
    library(Seurat)
    ```

The error message in the console is:

27 Jun 2019 15:50:44 [rsession-] ERROR system error 13 (Permission denied) [description=No user specified]; OCCURRED AT: rstudio::core::Error rstudio::server_core::sessions::signRequest(const string&, rstudio::core::http::Request&, bool) /var/lib/jenkins/workspace/IDE_open-source-pipeline_v1.2/src/cpp/server_core/sessions/SessionSignature.cpp:42; LOGGED FROM: void rstudio::session::modules::rmarkdown::notebook::{anonymous}::NotebookQueue::consoleThreadMain() /var/lib/jenkins/workspace/IDE_open-source-pipeline_v1.2/src/cpp/session/modules/rmarkdown/NotebookQueue.cpp:498
rsession-[30]: ERROR system error 13 (Permission denied) [description=No user specified]; OCCURRED AT: rstudio::core::Error rstudio::server_core::sessions::signRequest(const string&, rstudio::core::http::Request&, bool) /var/lib/jenkins/workspace/IDE_open-source-pipeline_v1.2/src/cpp/server_core/sessions/SessionSignature.cpp:42; LOGGED FROM: void rstudio::session::modules::rmarkdown::notebook::{anonymous}::NotebookQueue::consoleThreadMain() /var/lib/jenkins/workspace/IDE_open-source-pipeline_v1.2/src/cpp/session/modules/rmarkdown/NotebookQueue.cpp:498

@ryanlovett
Copy link
Collaborator

I was able to reproduce the error. I had to add a lot more packages to get Seurat to install (new Dockerfile below) -- I didn't experiment with others. I'll see if the configurable_headers stuff I worked on earlier fixes it.

FROM jupyter/minimal-notebook

USER root

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

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-cran35/'
RUN apt update -qq -y

RUN add-apt-repository -y ppa:marutter/c2d4u3.5
RUN apt-get update -qq -y

RUN apt install -y r-base r-base-core r-recommended

# ENV RSTUDIO_VERSION 1.1.456
ENV RSTUDIO_VERSION 1.2.1335

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


RUN apt-get install -y r-cran-ape r-cran-assertthat r-cran-backports r-cran-base64enc r-cran-bibtex r-cran-bitops r-cran-catools r-cran-cli r-cran-colorspace r-cran-cowplot r-cran-crayon r-cran-crosstalk r-cran-curl r-cran-data.table r-cran-digest r-cran-dplyr r-cran-fitdistrplus r-cran-future r-cran-future.apply r-cran-gbrd r-cran-gdata r-cran-ggplot2 r-cran-ggrepel r-cran-ggridges r-cran-globals r-cran-glue r-cran-gplots r-cran-gridextra r-cran-gtable r-cran-gtools r-cran-hexbin r-cran-htmltools r-cran-htmlwidgets r-cran-httpuv r-cran-httr r-cran-ica r-cran-igraph r-cran-irlba r-cran-jsonlite r-cran-labeling r-cran-lazyeval r-cran-listenv r-cran-lmtest r-cran-lsei r-cran-magrittr r-cran-matrix r-cran-metap r-cran-mime r-cran-munsell r-cran-npsurv r-cran-openssl r-cran-pbapply r-cran-pillar r-cran-pkgconfig r-cran-plogr r-cran-plotly r-cran-plyr r-cran-png r-cran-purrr r-cran-r6 r-cran-rann r-cran-rcolorbrewer r-cran-rcpp r-cran-rcppeigen r-cran-rcppprogress r-cran-rmarkdown r-cran-rdpack r-cran-reshape2 r-cran-reticulate r-cran-rlang r-cran-r.methodss3 r-cran-rocr r-cran-r.oo r-cran-r.utils r-cran-scales r-cran-sdmtools r-cran-shiny r-cran-sourcetools r-cran-stringi r-cran-stringr r-cran-tibble r-cran-tidyr r-cran-tidyselect r-cran-utf8 r-cran-viridislite r-cran-withr r-cran-xtable r-cran-yaml r-cran-zoo


# r-cran-rsvd r-cran-rtsne r-cran-sctransform r-cran-tsne

RUN apt-get clean && rm -rf /var/lib/apt/lists/*

RUN Rscript -e "install.packages('Seurat')"

USER $NB_USER

RUN pip install git+https://github.com/jupyterhub/jupyter-server-proxy
# RUN pip install git+https://github.com/ryanlovett/jupyter-server-proxy@configurable_headers
RUN pip install git+https://github.com/jupyterhub/jupyter-rsession-proxy

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

CMD jupyter notebook --ip=0.0.0.0 --port=8888 --NotebookApp.token=

@scivm
Copy link

scivm commented Apr 1, 2020

Hi. I am seeing this same issue also using 1.2.5033. Easiest test case to reproduce is:

@ryanlovett Can I test your fix for this one?

simplest.Rmd:

simplest operation
```{r}
temp = 1 + 1

@scivm
Copy link

scivm commented Apr 3, 2020

I tried to hardcode the header in _build_proxy_request handlers.py of jupyter server proxy but not working....

    headers = self.proxy_request_headers()
    headers['X-RStudioUserIdentity'] = "jovyan"

@scivm
Copy link

scivm commented Apr 3, 2020

Not sure what is going on here. Updated the nginx ingress to always send the X-RStudioUserIdentity header with value of jovyan but it did not help. I can see that it is set from the logs of the user image but I still get the ERROR system error 13 (Permission denied) [description=No user specified]

@ryanlovett
Copy link
Collaborator

@scivm My changes were in branches of both jupyter-rsession-proxy and jupyter-server-proxy:

master...ryanlovett:proxy_headers

jupyterhub/jupyter-server-proxy@master...ryanlovett:configurable_headers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants