Fix actix worker wedge on session teardown; grant CAP_KILL; bump to 0.3.12
Build and Deploy to K3s / test (push) Successful in 2m6s
Build and Deploy to K3s / lint (push) Successful in 1m2s
Build and Deploy to K3s / build-and-push (push) Successful in 9m23s
Build and Deploy to K3s / deploy (push) Successful in 2m13s

Terminal::stopping did child.kill() (error ignored) and then a blocking
child.wait() on the actix worker thread. Since the 0.3.11 privilege drop,
sessions run as `demo` and the server had no CAP_KILL, so kill() failed
with EPERM and wait() blocked forever. With two workers, exactly every
other request to :8082 then timed out — 5 days of readiness/liveness
flapping on socktop.io and orphaned restricted-shell/socktop processes
piling up in the pods.

- Signal the session's whole process group (portable-pty setsid()s the
  child), not just the shell: a non-interactive bash defers signals while
  a foreground command runs, so the old SIGHUP/SIGKILL to the shell alone
  orphaned socktop anyway.
- Reap on a dedicated thread: SIGHUP, 2 s grace, SIGKILL, 10 s deadline,
  then a blocking wait on that thread only. Signal failures are logged.
- Drop the pty handles before handing off the child.
- kubernetes/03-deployment.yaml: add CAP_KILL (sessions still lose every
  cap via setpriv). CI never applies the manifest — it was patched live.
- tests/reaper_tests.rs pins the non-blocking return, process-group kill,
  and SIGHUP→SIGKILL escalation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jasonwitty
2026-08-29 17:53:53 -07:00
parent 5637dea10b
commit 1114482046
5 changed files with 280 additions and 13 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ documentation = "https://docs.rs/webterm"
readme = "README.md"
categories = ["web-programming", "web-programming::websocket", "web-programming::http-server", "command-line-utilities"]
keywords = ["terminal", "xterm", "websocket", "terminus", "console"]
version = "0.3.11"
version = "0.3.12"
authors = ["fabian.freyer@physik.tu-berlin.de","jasonpwitty+socktop@proton.me"]
edition = "2021"
license = "BSD-3-Clause"