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

Terminal not working in RStudio #71

Open
anton-khodak opened this issue Jun 28, 2019 · 9 comments
Open

Terminal not working in RStudio #71

anton-khodak opened this issue Jun 28, 2019 · 9 comments

Comments

@anton-khodak
Copy link
Contributor

Hello! When I run jupyter-rsession-proxy with this Dockerfile and try opening a terminal in RStudio, I get the following error in console:

[I 09:15:51.316 NotebookApp] Trying to establish websocket connection to ws://localhost:46203/p/a345fca3/terminal/C3090FD3/
[E 09:15:51.471 NotebookApp] Exception in callback functools.partial(<bound method IOLoop._discard_future_result of <tornado.platform.asyncio.AsyncIOMainLoop object at 0x7f35952d9b38>>, <Task finished coro=<ProxyHandler.proxy_open.<locals>.start_websocket_connection() done, defined at /opt/conda/lib/python3.7/site-packages/jupyter_server_proxy/handlers.py:258> exception=HTTP 404: Not Found>)
    Traceback (most recent call last):
      File "/opt/conda/lib/python3.7/site-packages/tornado/ioloop.py", line 743, in _run_callback
        ret = callback()
      File "/opt/conda/lib/python3.7/site-packages/tornado/ioloop.py", line 767, in _discard_future_result
        future.result()
      File "/opt/conda/lib/python3.7/site-packages/jupyter_server_proxy/handlers.py", line 263, in start_websocket_connection
        on_message_callback=message_cb, on_ping_callback=ping_cb)
    tornado.httpclient.HTTPClientError: HTTP 404: Not Found

and the terminal displays nothing
image

@riazarbi
Copy link

Me too -

[I 20:02:26.977 NotebookApp] Trying to establish websocket connection to ws://localhost:54789/p/af1d970b/terminal/418A9C1A/
[E 20:02:26.980 NotebookApp] Exception in callback functools.partial(<bound method IOLoop._discard_future_result of <tornado.platform.asyncio.AsyncIOMainLoop object at 0x7fd7ceb825c0>>, <Task finished coro=<ProxyHandler.proxy_open.<locals>.start_websocket_connection() done, defined at /usr/local/lib/python3.6/dist-packages/jupyter_server_proxy/handlers.py:258> exception=HTTP 404: Not Found>)
    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/dist-packages/tornado/ioloop.py", line 743, in _run_callback
        ret = callback()
      File "/usr/local/lib/python3.6/dist-packages/tornado/ioloop.py", line 767, in _discard_future_result
        future.result()
      File "/usr/local/lib/python3.6/dist-packages/jupyter_server_proxy/handlers.py", line 263, in start_websocket_connection
        on_message_callback=message_cb, on_ping_callback=ping_cb)
    tornado.httpclient.HTTPClientError: HTTP 404: Not Found
[E 20:02:49.098 NotebookApp] Uncaught exception POST /rstudio/events/get_events (192.168.2.1)
    HTTPServerRequest(protocol='http', host='127.0.0.1:8888', method='POST', uri='/rstudio/events/get_events', version='HTTP/1.1', remote_ip='192.168.2.1')
    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/dist-packages/tornado/web.py", line 1699, in _execute
        result = await result
      File "/usr/local/lib/python3.6/dist-packages/jupyter_server_proxy/handlers.py", line 434, in proxy
        return await super().proxy(self.port, path)
      File "/usr/local/lib/python3.6/dist-packages/jupyter_server_proxy/handlers.py", line 199, in proxy
        response = await client.fetch(req, raise_error=False)
    tornado.simple_httpclient.HTTPTimeoutError: Timeout during request

Salient parts of my Dockerfile -

RUN python3 -m pip install --upgrade pip && \
    python3 -m pip install jupyter jupyterhub jupyterlab
...
...

 && python3 -m pip install git+https://github.com/jupyterhub/jupyter-server-proxy \
 && python3 -m pip install git+https://github.com/jupyterhub/jupyter-rsession-proxy

@riazarbi
Copy link

A workaround I have found is to turn off websockets under Tools -> Global Options -> Terminal. This fixes it. Not sure how to set this programmatically so I can bake it into an image...

@riazarbi
Copy link

Another workaround is to use the pypi version of jupyter-rsession-proxy rather than the github version. This is version 1.0.b6 and terminal works with websockets.

@zjiaksmc
Copy link

I figure out another workaround. I manually change the global options in my session, export the user-settings file from /home/jovyan/.rstudio/monitored/user-settings/, then use kuberspawner lifecycle_hooks to copy this user-settings to the home directory of every user who try to spawn a rstudio container.
lifecycle_hooks = {"postStart": { "exec": { "command": ["/bin/sh", "/etc/rstudio/config-rstudio.sh"] } }}
config-rstudio.sh can be like
mkdir /home/jovyan/.rstudio/monitored/user-settings -p && cp /etc/rstudio/user-settings/user-settings /home/jovyan/.rstudio/monitored/user-settings/

@BigDataRsk
Copy link

@anton-khodak Hi, did you found a solution for this ? I am facing the same problem.

@prete
Copy link

prete commented Feb 25, 2020

@FernandezMathieu
With @anton-khodak we got it working using rstudio-server-1.2.5019-amd64.deb with the latest jupyter-server-proxy and juvipanda's jupyter-rsession-proxy.

Relevant parts of our Dockerfile

# jupyter-server-proxy extension
RUN pip install jupyter-server-proxy
# use yuvipanda version of jupyter-rsession-proxy (nbrsessionproxy)
RUN pip install https://github.com/yuvipanda/nbrsessionproxy/archive/rserver-again.zip
RUN jupyter serverextension enable --sys-prefix jupyter_server_proxy

@BigDataRsk
Copy link

@FernandezMathieu
With @anton-khodak we got it working using rstudio-server-1.2.5019-amd64.deb with the latest jupyter-server-proxy and juvipanda's jupyter-rsession-proxy.

Relevant parts of our Dockerfile

# jupyter-server-proxy extension
RUN pip install jupyter-server-proxy
# use yuvipanda version of jupyter-rsession-proxy (nbrsessionproxy)
RUN pip install https://github.com/yuvipanda/nbrsessionproxy/archive/rserver-again.zip
RUN jupyter serverextension enable --sys-prefix jupyter_server_proxy

Well, i try with your configuration but it still don't work.
Anyway i think the problem come from my distribution (centOS).
Thanks for the reply !

@prete
Copy link

prete commented Feb 25, 2020

If you share your Dockerfile perhaps we can find the main differences and go from there. You can find our whole Dockerfile here (there be dragons in there).

@hongkunyoo
Copy link

hongkunyoo commented Mar 6, 2020

@BigDataRsk

Well, i try with your configuration but it still don't work.
Anyway i think the problem come from my distribution (centOS).
Thanks for the reply !

I'm facing same experience. Works fine on ubuntu host server, while having tornado.simple_httpclient.HTTPTimeoutError: Timeout during request on centOS host server

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

6 participants