yuvipanda / jupyter-desktop-server

Run a Linux Desktop on a JupyterHub
BSD 3-Clause "New" or "Revised" License
46 stars 36 forks source link

Find an available port. #6

Closed ryanlovett closed 4 years ago

ryanlovett commented 5 years ago

Dynamically choose an available port.

This probably isn't needed when run in a container.

yuvipanda commented 5 years ago

Thanks @ryanlovett. One comment, then good to go!

ryanlovett commented 5 years ago

Done, thanks!

yuvipanda commented 5 years ago

I tested this (with repo2docker .) and it fails with:

127.0.0.1 - - [06/Nov/2019 21:34:45] "GET /websockify HTTP/1.1" 101 -
127.0.0.1 - - [06/Nov/2019 21:34:45] 127.0.0.1: Plain non-SSL (ws://) WebSocket connection
127.0.0.1 - - [06/Nov/2019 21:34:45] 127.0.0.1: Path: '/websockify'
127.0.0.1 - - [06/Nov/2019 21:34:45] connecting to command: '/srv/conda/envs/notebook/lib/python3.7/site-packages/jupyter_desktop/share/tigervnc/bin/vncserver -verbose -xstartup /srv/conda/envs/notebook/lib/python3.7/site-packages/jupyter_desktop/share/xstartup -geometry 1024x768 -SecurityTypes None -rfbunixpath /tmp/tmp7kppt3fb/vnc-socket -fg :0' (port 41657)

New 'd11d75896232:1 (yuvipanda)' desktop is d11d75896232:1

Creating default config /home/yuvipanda/.vnc/config
Starting applications specified in /srv/conda/envs/notebook/lib/python3.7/site-packages/jupyter_desktop/share/xstartup
Log file is /home/yuvipanda/.vnc/d11d75896232:1.log

Killing Xvnc process ID 38
127.0.0.1 - - [06/Nov/2019 21:34:47] 127.0.0.1:41657: Target closed connection
127.0.0.1 - - [06/Nov/2019 21:34:47] 127.0.0.1:41657: Closed target
Xvnc seems to be deadlocked.  Kill the process manually and then re-run
    /srv/conda/envs/notebook/lib/python3.7/site-packages/jupyter_desktop/share/tigervnc/bin/vncserver -kill :1
to clean up the socket files.
Wrapped command exited (or daemon). Returned 0
In exit
Closing socket listening at :5900

If I open the log file mentioned there,

uvipanda@d11d75896232:~$ cat ~/.vnc/d11d75896232\:1.log
_XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created.
(WW) Failed to open protocol names file /usr/lib64/xorg/protocol.txt

Xvnc TigerVNC 1.9.0 - built Jul 16 2018 14:18:04
Copyright (C) 1999-2018 TigerVNC Team and many others (see README.rst)
See http://www.tigervnc.org for information on TigerVNC.
Underlying X server release 11400000, The X.Org Foundation

Initializing built-in extension VNC-EXTENSION
Initializing built-in extension Generic Event Extension
Initializing built-in extension SHAPE
Initializing built-in extension MIT-SHM
Initializing built-in extension XInputExtension
Initializing built-in extension XTEST
Initializing built-in extension BIG-REQUESTS
Initializing built-in extension SYNC
Initializing built-in extension XKEYBOARD
Initializing built-in extension XC-MISC
Initializing built-in extension XINERAMA
Initializing built-in extension XFIXES
Initializing built-in extension RENDER
Initializing built-in extension RANDR
Initializing built-in extension COMPOSITE
Initializing built-in extension DAMAGE
Initializing built-in extension MIT-SCREEN-SAVER
Initializing built-in extension DOUBLE-BUFFER
Initializing built-in extension RECORD
Initializing built-in extension DPMS
Initializing built-in extension X-Resource
Initializing built-in extension XVideo
Initializing built-in extension XVideo-MotionCompensation
Initializing built-in extension GLX

Wed Nov  6 21:34:44 2019
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on /tmp/tmp7kppt3fb/vnc-socket
              (mode 0600)
 vncext:      created VNC server for screen 0
(EE) AIGLX error: dlopen of /usr/lib64/swrast_dri.so failed (/usr/lib64/swrast_dri.so: cannot open shared object file: No such file or directory)
(EE) GLX: could not load software renderer
(II) GLX: no usable GL providers found for screen 0

Wed Nov  6 21:34:45 2019
 Connections: accepted: /tmp/tmp7kppt3fb/vnc-socket
 SConnection: Client needs protocol version 3.8
 SConnection: Client requests security type None(1)
 VNCSConnST:  Server default pixel format depth 24 (32bpp) little-endian rgb888
 VNCSConnST:  Client pixel format depth 24 (32bpp) little-endian rgb888
xfce4-session: Cannot open display: .
Type 'xfce4-session --help' for usage.

Wed Nov  6 21:34:47 2019
 Connections: closed: /tmp/tmp7kppt3fb/vnc-socket (Server shutdown)
 EncodeManager: Framebuffer updates: 2
 EncodeManager:   Tight:
 EncodeManager:     Solid: 1 rects, 786.432 kpixels
 EncodeManager:            16 B (1:196609 ratio)
 EncodeManager:   Total: 1 rects, 786.432 kpixels
 EncodeManager:          16 B (1:196609 ratio)
 ComparingUpdateTracker: 0 pixels in / 0 pixels out
 ComparingUpdateTracker: (1:-nan ratio)

Ultimately for xfce4-session: Cannot open display: . maybe?

ryanlovett commented 5 years ago

Interesting, it should equate to the same args. Will take a look and fix.

manics commented 5 years ago

Note as an aside: 127.0.0.1 - - [06/Nov/2019 21:34:45] connecting to command: '/srv/conda/envs/notebook/lib/python3.7/site-packages/jupyter_desktop/share/tigervnc/bin/vncserver -verbose -xstartup /srv/conda/envs/notebook/lib/python3.7/site-packages/jupyter_desktop/share/xstartup -geometry 1024x768 -SecurityTypes None -rfbunixpath /tmp/tmp7kppt3fb/vnc-socket -fg :0' (port 41657)

I think the (port 41657) is due to https://github.com/yuvipanda/jupyter-desktop/issues/7 and can be ignored (websockify always picks a random port to remap to)

ryanlovett commented 4 years ago

Closing because I haven't researched this well enough.