linuxserver / docker-baseimage-kasmvnc

Base Images for remote web based Linux desktops using KasmVNC for many popular distros.
GNU General Public License v3.0
281 stars 48 forks source link

[BUG] Uncaught TypeError: Cannot read properties of undefined (reading 'lastActiveAt') #68

Open gijs-blanken opened 2 months ago

gijs-blanken commented 2 months ago

Is there an existing issue for this?

Current Behavior

I have the latest docker-chromium image running. It starts up fine but whenever there is a period of inactivity (or when I close my laptop lid) I get the following error. When the page is refreshed this error goes away.

Screenshot 2024-06-10 at 19 27 30

Please let me know if there is anything else I can provide!

Expected Behavior

I don't expect there to be an error after I've closed and re-opened my laptop or for a short period of inactivity.

Steps To Reproduce

  1. I have the docker-chromium image (with this repo as its base) running inside a kubernetes pool. There's quite a bit of networking configuration happening which I can provide if needed.
  2. Visite the kasmvnc url.
  3. Whenever I leave the tab unattended for a while I get the error above. A more easy way to reproduce this error is to close my laptop lid and reopen it after about 3 seconds.

When looking in the network tab of my browser I notice that that the websockify websocket stops receiving messages. The socket.io does seem to be active even after the error appeared.

Environment

- Running on GCP instances with kubernetes.
- Running https://github.com/linuxserver/docker-chromium (this seemed like a more appropriate place to report as this most likely affects all images that use this base image)

Docker creation

FROM linuxserver/chromium:arm64v8-version-3d416ebf
ENV LC_ALL="nl_NL.UTF-8"
ENV FM_HOME="/config/Downloads"
ENV TZ="Europe/Amsterdam"
ENV PUID=1000
ENV PGID=1001
ENV NO_DECOR=true

# Resolves an error for xdb not installed.
RUN apt-get update && apt-get install python3-xdg
RUN mkdir /config/Downloads

# Add a chromium menu item
COPY apps/remote-desktop-vm/root /

Container logs

remote-desktop-vm [migrations] started                                                                                                                                                                                                                       │
│ remote-desktop-vm [migrations] no migrations found                                                                                                                                                                                                           │
│ remote-desktop-vm ───────────────────────────────────────                                                                                                                                                                                                    │
│ remote-desktop-vm                                                                                                                                                                                                                                            │
│ remote-desktop-vm       ██╗     ███████╗██╗ ██████╗                                                                                                                                                                                                          │
│ remote-desktop-vm       ██║     ██╔════╝██║██╔═══██╗                                                                                                                                                                                                         │
│ remote-desktop-vm       ██║     ███████╗██║██║   ██║                                                                                                                                                                                                         │
│ remote-desktop-vm       ██║     ╚════██║██║██║   ██║                                                                                                                                                                                                         │
│ remote-desktop-vm       ███████╗███████║██║╚██████╔╝                                                                                                                                                                                                         │
│ remote-desktop-vm       ╚══════╝╚══════╝╚═╝ ╚═════╝                                                                                                                                                                                                          │
│ remote-desktop-vm                                                                                                                                                                                                                                            │
│ remote-desktop-vm    Brought to you by linuxserver.io                                                                                                                                                                                                        │
│ remote-desktop-vm ───────────────────────────────────────                                                                                                                                                                                                    │
│ remote-desktop-vm                                                                                                                                                                                                                                            │
│ remote-desktop-vm To support LSIO projects visit:                                                                                                                                                                                                            │
│ remote-desktop-vm https://www.linuxserver.io/donate/                                                                                                                                                                                                         │
│ remote-desktop-vm                                                                                                                                                                                                                                            │
│ remote-desktop-vm ───────────────────────────────────────                                                                                                                                                                                                    │
│ remote-desktop-vm GID/UID                                                                                                                                                                                                                                    │
│ remote-desktop-vm ───────────────────────────────────────                                                                                                                                                                                                    │
│ remote-desktop-vm                                                                                                                                                                                                                                            │
│ remote-desktop-vm User UID:    1000                                                                                                                                                                                                                          │
│ remote-desktop-vm User GID:    1001                                                                                                                                                                                                                          │
│ remote-desktop-vm ───────────────────────────────────────                                                                                                                                                                                                    │
│ remote-desktop-vm                                                                                                                                                                                                                                            │
│ remote-desktop-vm ....+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*..+......+..........+.....+..........+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.+....+..+.+.................+.+.....+.......+........+...... │
│ remote-desktop-vm ...+........+......+.+.....+....+...+..+......+............+.+......+......+..+.......+.....+.+.........+...+............+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.......+.....+............+++++++++++++++++++++ │
│ remote-desktop-vm -----                                                                                                                                                                                                                                      │
│ remote-desktop-vm [custom-init] No custom files found, skipping...                                                                                                                                                                                           │
│ remote-desktop-vm _XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created.                                                                                                                                                           │
│ remote-desktop-vm                                                                                                                                                                                                                                            │
│ remote-desktop-vm Xvnc KasmVNC 1.2.0 - built Apr 15 2024 21:20:52                                                                                                                                                                                            │
│ remote-desktop-vm Copyright (C) 1999-2018 KasmVNC Team and many others (see README.me)                                                                                                                                                                       │
│ remote-desktop-vm See http://kasmweb.com for information on KasmVNC.                                                                                                                                                                                         │
│ remote-desktop-vm Underlying X server release 12014000, The X.Org Foundation                                                                                                                                                                                 │
│ remote-desktop-vm                                                                                                                                                                                                                                            │
│ remote-desktop-vm [ls.io-init] done.                                                                                                                                                                                                                         │
│ remote-desktop-vm Obt-Message: Xinerama extension is not present on the server                                                                                                                                                                               │
│ remote-desktop-vm  2024-06-10 18:56:56,811 [INFO] websocket 0: got client connection from 127.0.0.1                                                                                                                                                          │
│ remote-desktop-vm  2024-06-10 18:56:56,818 [PRIO] Connections: accepted: @149.210.159.135_1718038616.812103::websocket                                                                                                                                       │
│ remote-desktop-vm  2024-06-10 18:58:51,749 [PRIO] Connections: closed: @149.210.159.135_1718038616.812103::websocket (Clean disconnection)                                                                                                                   │
│ remote-desktop-vm  2024-06-10 19:16:14,264 [INFO] websocket 1: got client connection from 127.0.0.1                                                                                                                                                          │
│ remote-desktop-vm  2024-06-10 19:16:14,270 [PRIO] Connections: accepted: @149.210.159.135_1718039774.265100::websocket                                                                                                                                       │
│ remote-desktop-vm  2024-06-10 19:19:45,267 [PRIO] Connections: closed: @149.210.159.135_1718039774.265100::websocket (Clean disconnection)
github-actions[bot] commented 2 months ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

j0nnymoe commented 2 months ago

This will be happening because your browser is sleeping the tabs/disconnecting the session with Kasmvnc.

gijs-blanken commented 2 months ago

This will be happening because your browser is sleeping the tabs/disconnecting the session with Kasmvnc.

I have my own websocket running (Soketi and Echo) and that manages to stay active without any trouble (or at the very least reconnect when the connection is closed). I would expect the same from KasmVNC.

EDIT: I previously mentioned that I was running KasmVNC inside an iFrame. I just tried the same steps to reproduce the issue without using an iFrame and this leads to the same error.

thelamer commented 2 months ago

There is no websocket reconnection logic baked into KasmVNC. If you disconnect you need to reload the page.

maxvisser commented 2 months ago

What if we would add something like ping/pong messages between the client and the server. Would the heartbeat not keep it open for longer? Probably needs to be an optional setting as it would be counterintuitive against settings like closing sessions based on user timeout.

thelamer commented 2 months ago

That's fine, but I don't have universal control over the upstream project: https://github.com/kasmtech/novnc

To do it correctly the disconnect, reconnect, count, and backoff should be baked into the upstream code.

LinuxServer-CI commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.