Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[BUG] Workspace sessions are still left stopped after an unclean shutdown

未关闭
#111 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
docker, python, shell
领域
devops

调研方向

Look at the svc-kasm/finish script that records session state on clean shutdown; it likely writes to a file or database. After an unclean shutdown, dockerd restarts session containers, and svc-kasm/run stops them. Examine the run script to see how it decides to stop containers and where session state is stored. The fix may involve detecting an unclean shutdown and reconciling container states with Kasm's records, possibly by checking Docker events or container labels. Test by reproducing the steps with docker kill and verifying sessions resume correctly.

由索引模型根据 Issue 内容生成。

描述

Is there an existing issue for this?
  • I have searched the existing issues
Current Behavior

With #108 and #109, a clean stop brings the sessions back, because svc-kasm/finish records them. After an unclean shutdown (docker kill, power loss, OOM kill), finish does not run, so nothing is recorded: dockerd restarts the session containers and svc-kasm/run stops them again, as in #106. Kasm keeps showing them as running while their containers are Exited (2). For a running one, resume_kasm answers Session (901e0d37-3fff-4ab2-a039-9957718ad859) is in status (running) and cannot be resumed and get_kasm_status answers Kasm is not running.

$ docker exec kasm docker events --since 10m --until "$(date +%s)" --filter label=kasm.kasmid --format '{{.Action}} {{.Actor.Attributes.name}} {{.Actor.Attributes.signal}}'
start userkasm.loc_901e0d37 <no value>
start adminkasm.lo_b9e6c4c2 <no value>
kill adminkasm.lo_b9e6c4c2 15
kill userkasm.loc_901e0d37 15
stop adminkasm.lo_b9e6c4c2 <no value>
die adminkasm.lo_b9e6c4c2 <no value>
stop userkasm.loc_901e0d37 <no value>
die userkasm.loc_901e0d37 <no value>
Expected Behavior

Sessions come back in the state Kasm has them in after an unclean shutdown too.

Steps To Reproduce
  1. On an image built from #109, launch a Workspace session.
  2. docker kill kasm, then docker start kasm.
  3. docker exec kasm docker ps -a --filter label=kasm.kasmid shows the session container Exited (2), while Kasm still has the session as running.
  4. resume_kasm and get_kasm_status for it fail with the errors above.
Environment
- OS: Ubuntu 24.04.4 LTS (kernel 6.18, cgroup v1)
- How docker service was installed: docker-ce 29.3.1 from Docker's apt repository
- Workspace image: kasmweb/remmina:1.19.0-rolling-daily
CPU architecture

x86-64

Docker creation
docker run -d --name kasm --privileged --network host --stop-timeout 90 \
  -e KASM_PORT=443 \
  -v /path/to/kasm/data:/opt \
  kasm:pr-109
# kasm:pr-109 = lscr.io/linuxserver/kasm:1.19.0-ls150 with the root/ of #109 copied in
# plus HTTPS_PROXY and a CA bundle for the test VM's egress proxy
Container logs
[migrations] started
[migrations] no migrations found
usermod: no changes
───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝

   Brought to you by linuxserver.io
───────────────────────────────────────

To support LSIO projects visit:
https://www.linuxserver.io/donate/

───────────────────────────────────────
GID/UID
───────────────────────────────────────

User UID:    911
User GID:    911
───────────────────────────────────────
Linuxserver.io version: 1.19.0-ls150
Build-date: 2026-09-22T23:50:52+00:00
───────────────────────────────────────
    
[custom-init] No custom files found, skipping...
time="2026-09-23T12:43:13Z" level=warning msg="Configuration migrated from version 2, use `containerd config migrate` to avoid migration" t="15.2µs"
time="2026-09-23T12:43:13.017537512Z" level=error msg="copy shim log after reload" error="read /proc/self/fd/14: file already closed" namespace=moby
time="2026-09-23T12:43:13.017817259Z" level=error msg="copy shim log after reload" error="read /proc/self/fd/15: file already closed" namespace=moby
time="2026-09-23T12:43:13.017904989Z" level=error msg="copy shim log after reload" error="read /proc/self/fd/18: file already closed" namespace=moby
time="2026-09-23T12:43:13.130294646Z" level=error msg="failed to load shim /var/run/docker/containerd/daemon/io.containerd.runtime.v2.task/moby/27b8bff25815e2cd4af1bee97c569ef755b37b9057e0fbbc72c0d671a36e69f4" error="unable to load shim \"27b8bff25815e2cd4af1bee97c569ef755b37b9057e0fbbc72c0d671a36e69f4\": unable to make connection: failed to create TTRPC connection: dial unix /run/containerd/s/37e3ebd05e4ddff1e1b125b57d7ea9995f5c4af49ec9391fab2e929b6b210fbc: connect: connection refused" namespace=moby
time="2026-09-23T12:43:13.133353368Z" level=error msg="failed to load shim /var/run/docker/containerd/daemon/io.containerd.runtime.v2.task/moby/2a148ec3a5dc255c21e9fb91340bc0ac11d1583edc2be91fd278319846bc545b" error="unable to load shim \"2a148ec3a5dc255c21e9fb91340bc0ac11d1583edc2be91fd278319846bc545b\": unable to make connection: failed to create TTRPC connection: dial unix /run/containerd/s/5c4cf49557be2de1aae96530027546f2f2299f161b0ba9524f1a8fa70f4e82b8: connect: connection refused" namespace=moby
time="2026-09-23T12:43:13.133924705Z" level=error msg="failed to load shim /var/run/docker/containerd/daemon/io.containerd.runtime.v2.task/moby/61d998872cbb20443a7af5a389b38e4f282f07328576b7b18181b734c37590ac" error="unable to load shim \"61d998872cbb20443a7af5a389b38e4f282f07328576b7b18181b734c37590ac\": unable to make connection: failed to create TTRPC connection: dial unix /run/containerd/s/e889777e735fddb877e3f3e43cb9442ce61f42b0a522e3c60cc7b21f30f69afb: connect: connection refused" namespace=moby
time="2026-09-23T12:43:13.134313665Z" level=error msg="failed to load shim /var/run/docker/containerd/daemon/io.containerd.runtime.v2.task/moby/3e54f960d62d7926ccfde06286db78c6f68858c8b40e3b3d3b25e19d1aea2d33" error="unable to load shim \"3e54f960d62d7926ccfde06286db78c6f68858c8b40e3b3d3b25e19d1aea2d33\": unable to make connection: failed to create TTRPC connection: dial unix /run/containerd/s/7657085ee36704ddc3b26ce0658ae70be30a75b405b1c57b978cb20a6e464e47: connect: connection refused" namespace=moby
time="2026-09-23T12:43:13.242657246Z" level=error msg="failed to load shim /var/run/docker/containerd/daemon/io.containerd.runtime.v2.task/moby/629d389f37a8f88a2f8c67c1af62a7f51d1040a4bc8735fa6f4693cd9b61afea" error="unable to load shim \"629d389f37a8f88a2f8c67c1af62a7f51d1040a4bc8735fa6f4693cd9b61afea\": unable to make connection: failed to create TTRPC connection: dial unix /run/containerd/s/8889b32afc105e6d0d3311db88fff2a86c9a0c8a3a7da78e7b93df5bdaee3dad: connect: connection refused" namespace=moby
time="2026-09-23T12:43:13.243014379Z" level=error msg="copy shim log after reload" error="read /proc/self/fd/14: file already closed" namespace=moby
time="2026-09-23T12:43:13.247450145Z" level=error msg="failed to load shim /var/run/docker/containerd/daemon/io.containerd.runtime.v2.task/moby/ae95726ff702d481723a5d0e4fbd507684774905b6bf409f2d8bc15897c87cef" error="unable to load shim \"ae95726ff702d481723a5d0e4fbd507684774905b6bf409f2d8bc15897c87cef\": unable to make connection: failed to create TTRPC connection: dial unix /run/containerd/s/f03993851229af3d76e244f86e04e50d8545af59f58b95c26b601046cf9f5f1f: connect: connection refused" namespace=moby
time="2026-09-23T12:43:13.247527082Z" level=error msg="failed to load shim /var/run/docker/containerd/daemon/io.containerd.runtime.v2.task/moby/6b21a298d289979fe33460911f06b67b8ba7ec946dfe0041bbc4b0be2c4fdbfb" error="unable to load shim \"6b21a298d289979fe33460911f06b67b8ba7ec946dfe0041bbc4b0be2c4fdbfb\": unable to make connection: failed to create TTRPC connection: dial unix /run/containerd/s/0ad285af1176bed235e7f5a4a3ee859fb3515f58f8379128b70b6911b117300f: connect: connection refused" namespace=moby
time="2026-09-23T12:43:13.247699339Z" level=error msg="copy shim log after reload" error="read /proc/self/fd/5: file already closed" namespace=moby
time="2026-09-23T12:43:13.251627716Z" level=error msg="failed to load shim /var/run/docker/containerd/daemon/io.containerd.runtime.v2.task/moby/c243162350be44e2a9c31cd0c7394c2eb135a202472532b50d969d809e57e0ed" error="unable to load shim \"c243162350be44e2a9c31cd0c7394c2eb135a202472532b50d969d809e57e0ed\": unable to make connection: failed to create TTRPC connection: dial unix /run/containerd/s/794406c9d22f05a751523b8c90209d97815cae11e9c0adf192cfb86db22a46b6: connect: connection refused" namespace=moby
time="2026-09-23T12:43:13.356201095Z" level=error msg="failed to load shim /var/run/docker/containerd/daemon/io.containerd.runtime.v2.task/moby/cd2973997bcac668da51edaf273e81bc510cd865c14fba9ccf503f6eeb9e2fa2" error="unable to load shim \"cd2973997bcac668da51edaf273e81bc510cd865c14fba9ccf503f6eeb9e2fa2\": unable to make connection: failed to create TTRPC connection: dial unix /run/containerd/s/c853f4703d830ee616256df72a004a1c347c25acba578cd7858f5a148366591d: connect: connection refused" namespace=moby
time="2026-09-23T12:43:13.357643285Z" level=error msg="failed to load shim /var/run/docker/containerd/daemon/io.containerd.runtime.v2.task/moby/d3ec264188865353e9a206928def2ca1bf299d09bfff9157c0ff061210d90c11" error="unable to load shim \"d3ec264188865353e9a206928def2ca1bf299d09bfff9157c0ff061210d90c11\": unable to make connection: failed to create TTRPC connection: dial unix /run/containerd/s/78bf65057863ea4c4b188c17a71a7ac4fef2d76f5342acc6bbc57eed89584105: connect: connection refused" namespace=moby
time="2026-09-23T12:43:13.468578432Z" level=error msg="failed to load shim /var/run/docker/containerd/daemon/io.containerd.runtime.v2.task/plugins.moby/39040d0a342598a0a73f2eb011795b3f62f744ed010799b4efa8408e08c1a8c6" error="unable to load shim \"39040d0a342598a0a73f2eb011795b3f62f744ed010799b4efa8408e08c1a8c6\": unable to make connection: failed to create TTRPC connection: dial unix /run/containerd/s/3264f40744e24e8f698eb56e017b02704a6d53c95c3392a7bf6a800cf1e1a32b: connect: connection refused" namespace=plugins.moby
time="2026-09-23T12:43:13.468788041Z" level=error msg="failed to load shim /var/run/docker/containerd/daemon/io.containerd.runtime.v2.task/plugins.moby/3b563bb3570b26a02f9250083b57c7e11d4bdb7b83ab4724497a920d3dbc565d" error="unable to load shim \"3b563bb3570b26a02f9250083b57c7e11d4bdb7b83ab4724497a920d3dbc565d\": unable to make connection: failed to create TTRPC connection: dial unix /run/containerd/s/546926296c9b5531eddcdf7066367b63beb659213011edac14ace067c3199cf1: connect: connection refused" namespace=plugins.moby
time="2026-09-23T12:43:13Z" level=error msg="+ echo '[ENTRYPOINT] STARTED'" plugin=3b563bb3570b26a02f9250083b57c7e11d4bdb7b83ab4724497a920d3dbc565d
time="2026-09-23T12:43:13Z" level=error msg="+ SOCKET_PATH=/run/docker/plugins/kasmlogger.sock" plugin=3b563bb3570b26a02f9250083b57c7e11d4bdb7b83ab4724497a920d3dbc565d
time="2026-09-23T12:43:13Z" level=error msg="+ '[' -e /run/docker/plugins/kasmlogger.sock ]" plugin=3b563bb3570b26a02f9250083b57c7e11d4bdb7b83ab4724497a920d3dbc565d
time="2026-09-23T12:43:13Z" level=error msg="+ echo '[ENTRYPOINT] Launching plugin.py...'" plugin=3b563bb3570b26a02f9250083b57c7e11d4bdb7b83ab4724497a920d3dbc565d
time="2026-09-23T12:43:13Z" level=error msg="+ export 'PATH=/opt/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'" plugin=3b563bb3570b26a02f9250083b57c7e11d4bdb7b83ab4724497a920d3dbc565d
time="2026-09-23T12:43:13Z" level=error msg="+ sleep 5" plugin=3b563bb3570b26a02f9250083b57c7e11d4bdb7b83ab4724497a920d3dbc565d
time="2026-09-23T12:43:13Z" level=error msg="+ python3 /plugin.py" plugin=3b563bb3570b26a02f9250083b57c7e11d4bdb7b83ab4724497a920d3dbc565d
time="2026-09-23T12:43:13Z" level=info msg="[ENTRYPOINT] STARTED" plugin=3b563bb3570b26a02f9250083b57c7e11d4bdb7b83ab4724497a920d3dbc565d
time="2026-09-23T12:43:13Z" level=info msg="[ENTRYPOINT] Launching plugin.py..." plugin=3b563bb3570b26a02f9250083b57c7e11d4bdb7b83ab4724497a920d3dbc565d
time="2026-09-23T12:43:13Z" level=info msg=" * Serving Flask app 'plugin'" plugin=3b563bb3570b26a02f9250083b57c7e11d4bdb7b83ab4724497a920d3dbc565d
time="2026-09-23T12:43:13Z" level=info msg=" * Debug mode: off" plugin=3b563bb3570b26a02f9250083b57c7e11d4bdb7b83ab4724497a920d3dbc565d
time="2026-09-23T12:43:13Z" level=info msg=" * Serving Flask app 'plugin'" plugin=39040d0a342598a0a73f2eb011795b3f62f744ed010799b4efa8408e08c1a8c6
time="2026-09-23T12:43:13Z" level=info msg=" * Debug mode: off" plugin=39040d0a342598a0a73f2eb011795b3f62f744ed010799b4efa8408e08c1a8c6
Failed to fetch workspace list, falling back to local list.json: fetch failed
time="2026-09-23T12:43:14Z" level=error msg="/entrypoint.sh: line 6:     8 Killed                     python3 /plugin.py" plugin=39040d0a342598a0a73f2eb011795b3f62f744ed010799b4efa8408e08c1a8c6
time="2026-09-23T12:43:15Z" level=info msg=" * Serving Flask app 'plugin'" plugin=39040d0a342598a0a73f2eb011795b3f62f744ed010799b4efa8408e08c1a8c6
time="2026-09-23T12:43:15Z" level=info msg=" * Debug mode: off" plugin=39040d0a342598a0a73f2eb011795b3f62f744ed010799b4efa8408e08c1a8c6
time="2026-09-23T12:43:17Z" level=error msg="[2026-09-23 12:43:17,050] ERROR in logger: Failed to parse script log line on \"cat: can't open '/var/run/kasm-sidecar/00657915b847/ifaces': No such file or directory" plugin=39040d0a342598a0a73f2eb011795b3f62f744ed010799b4efa8408e08c1a8c6
time="2026-09-23T12:43:17Z" level=error msg="\": Expecting value: line 1 column 1 (char 0)" plugin=39040d0a342598a0a73f2eb011795b3f62f744ed010799b4efa8408e08c1a8c6
time="2026-09-23T12:43:17Z" level=error msg="[2026-09-23 12:43:17,730] ERROR in logger: Failed to parse script log line on \"cat: can't open '/var/run/kasm-sidecar/28cbdb3b54c7/ifaces': No such file or directory" plugin=39040d0a342598a0a73f2eb011795b3f62f744ed010799b4efa8408e08c1a8c6
time="2026-09-23T12:43:17Z" level=error msg="\": Expecting value: line 1 column 1 (char 0)" plugin=39040d0a342598a0a73f2eb011795b3f62f744ed010799b4efa8408e08c1a8c6
time="2026-09-23T12:43:18Z" level=error msg="+ echo '[ENTRYPOINT] Checking socket existence...'" plugin=3b563bb3570b26a02f9250083b57c7e11d4bdb7b83ab4724497a920d3dbc565d
time="2026-09-23T12:43:18Z" level=error msg="+ ls -l /run/docker/plugins" plugin=3b563bb3570b26a02f9250083b57c7e11d4bdb7b83ab4724497a920d3dbc565d
time="2026-09-23T12:43:18Z" level=info msg="[ENTRYPOINT] Checking socket existence..." plugin=3b563bb3570b26a02f9250083b57c7e11d4bdb7b83ab4724497a920d3dbc565d
time="2026-09-23T12:43:18Z" level=info msg="total 0" plugin=3b563bb3570b26a02f9250083b57c7e11d4bdb7b83ab4724497a920d3dbc565d
time="2026-09-23T12:43:18Z" level=info msg="prwx------    1 root     root             0 Sep 23 12:43 3b563bb3570b26a02f9250083b57c7e11d4bdb7b83ab4724497a920d3dbc565d-stderr" plugin=3b563bb3570b26a02f9250083b57c7e11d4bdb7b83ab4724497a920d3dbc565d
time="2026-09-23T12:43:18Z" level=info msg="prwx------    1 root     root             0 Sep 23 12:43 3b563bb3570b26a02f9250083b57c7e11d4bdb7b83ab4724497a920d3dbc565d-stdout" plugin=3b563bb3570b26a02f9250083b57c7e11d4bdb7b83ab4724497a920d3dbc565d
time="2026-09-23T12:43:18Z" level=info msg="srwxr-xr-x    1 root     root             0 Sep 23 12:43 kasmlogger.sock" plugin=3b563bb3570b26a02f9250083b57c7e11d4bdb7b83ab4724497a920d3dbc565d
time="2026-09-23T12:43:18Z" level=error msg="+ '[' '!' -S /run/docker/plugins/kasmlogger.sock ]" plugin=3b563bb3570b26a02f9250083b57c7e11d4bdb7b83ab4724497a920d3dbc565d
time="2026-09-23T12:43:18Z" level=error msg="+ tail -f /dev/null" plugin=3b563bb3570b26a02f9250083b57c7e11d4bdb7b83ab4724497a920d3dbc565d
Pulling Latest Kasm Service Images
time="2026-09-23T12:43:27Z" level=warning msg="/opt/kasm/1.19.0/docker/docker-compose.yaml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion"
 Image kasmweb/kasm-guac:1.19.0-rolling Pulling 
 Image kasmweb/proxy:1.19.0-rolling Pulling 
 Image kasmweb/manager:1.19.0-rolling Pulling 
 Image kasmweb/postgres:1.19.0-rolling Pulling 
 Image kasmweb/rdp-gateway:1.19.0-rolling Pulling 
 Image kasmweb/agent:1.19.0-rolling Pulling 
 Image kasmweb/rdp-https-gateway:1.19.0-rolling Pulling 
 Image kasmweb/api:1.19.0-rolling Pulling 
 Image kasmweb/rdp-https-gateway:1.19.0-rolling Pulled 
 Image kasmweb/api:1.19.0-rolling Pulled 
 Image kasmweb/kasm-guac:1.19.0-rolling Pulled 
 Image kasmweb/proxy:1.19.0-rolling Pulled 
 Image kasmweb/agent:1.19.0-rolling Pulled 
 Image kasmweb/manager:1.19.0-rolling Pulled 
 Image kasmweb/rdp-gateway:1.19.0-rolling Pulled 
 Image kasmweb/postgres:1.19.0-rolling Pulled 
Upgrading rolling plugins
Inspecting plugin:	kasmweb/logger:amd64-1.1-rolling-daily
* Type: log plugin
* Will not update rolling plugin: currently at the latest version
Inspecting plugin:	kasmweb/sidecar:amd64-1.5-rolling-daily
* Type: network plugin
* Will not update rolling plugin: currently at the latest version
Starting Kasm Services
time="2026-09-23T12:43:30Z" level=warning msg="/opt/kasm/1.19.0/docker/docker-compose.yaml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion"
 Container kasm_guac Starting 
 Container kasm_db Starting 
 Container kasm_guac Started 
 Container kasm_db Started 
 Container kasm_db Waiting 
 Container kasm_db Waiting 
 Container kasm_db Healthy 
 Container kasm_api Starting 
 Container kasm_db Healthy 
 Container kasm_manager Starting 
 Container kasm_api Started 
 Container kasm_rdp_gateway Starting 
 Container kasm_manager Started 
 Container kasm_agent Starting 
 Container kasm_rdp_gateway Started 
 Container kasm_agent Started 
 Container kasm_manager Waiting 
 Container kasm_api Waiting 
 Container kasm_api Healthy 
 Container kasm_manager Healthy 
 Container kasm_proxy Starting 
 Container kasm_proxy Started 
 Container kasm_rdp_https_gateway Starting 
 Container kasm_rdp_https_gateway Started 
[ls.io-init] done.
主要语言
Shell
星标
487
派生
51
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

linuxserver/docker-kasm 的其他 Issue

查看 linuxserver/docker-kasm 的全部 Issue

相似的 Issue

更多 Shell/Bash Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。