From 872eb7f8a9fc6a3660a6f3d28c32896d6780b263 Mon Sep 17 00:00:00 2001 From: valgulnecron <39313199+ValgulNecron@users.noreply.github.com> Date: Mon, 5 Oct 2026 02:37:49 +0200 Subject: [PATCH 1/2] fix(terraria,tmodloader): drop the tcpSocket readiness probe The Terraria server crashes with an ObjectDisposedException in Netplay.ServerLoop when a client connects and closes at once, which is exactly what the kubelet's tcpSocket readiness probe does every 10 s. On the kubelab live sweep the pod restarted 5 times in 6 minutes, and a crash during world generation left the restart stuck at "Choose World:". Both templates now declare no probe, like dont-starve-together; the operator then sets none on the game container. terraria 2.2.1 -> 2.2.2, tmodloader 1.0.0 -> 1.0.1. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01NsN6bnAMRM9XQtrTQ6KC7U Signed-off-by: valgulnecron <39313199+ValgulNecron@users.noreply.github.com> --- terraria/module.yaml | 2 +- terraria/specs.md | 2 +- terraria/template.yaml | 8 -------- tmodloader/module.yaml | 2 +- tmodloader/specs.md | 2 +- tmodloader/template.yaml | 8 -------- 6 files changed, 4 insertions(+), 20 deletions(-) diff --git a/terraria/module.yaml b/terraria/module.yaml index a43dfe3..b3b884a 100644 --- a/terraria/module.yaml +++ b/terraria/module.yaml @@ -2,7 +2,7 @@ apiVersion: gameplane.local/module/v1 name: terraria displayName: Terraria -version: 2.2.1 +version: 2.2.2 game: terraria categories: [Sandbox, Survival, Adventure, Modded] summary: Terraria + tModLoader dedicated server (passivelemon/terraria-docker) with a vanilla/tModLoader version picker and a tModLoader ModPacks volume. Console via container stdin. diff --git a/terraria/specs.md b/terraria/specs.md index 52495d5..4ae04c5 100644 --- a/terraria/specs.md +++ b/terraria/specs.md @@ -74,7 +74,7 @@ Declared ports under `spec.ports`: ## 8. Key Invariants & Security - **Network Wake Protocol**: Declares `wakeProtocol: terraria` under `spec.ports[game]` to allow wake-on-traffic. -- **Readiness Probe**: Uses TCP socket probe against port `7777`. +- **No Readiness Probe**: The template declares no probe. The server crashes (`ObjectDisposedException` in `Netplay.ServerLoop`) when a client connects and closes at once, which is exactly what a kubelet `tcpSocket` probe does, so a TCP probe crash-loops the pod. --- diff --git a/terraria/template.yaml b/terraria/template.yaml index 19869d4..f33a010 100644 --- a/terraria/template.yaml +++ b/terraria/template.yaml @@ -90,14 +90,6 @@ spec: image: passivelemon/terraria-docker:tmodloader-latest-pre # gameplane:floating loader: tmodloader - probes: - readiness: - tcpSocket: - port: game - initialDelaySeconds: 30 - periodSeconds: 10 - failureThreshold: 30 - capabilities: lifecycle: stop: ["exit"] diff --git a/tmodloader/module.yaml b/tmodloader/module.yaml index e23028a..4e1b63f 100644 --- a/tmodloader/module.yaml +++ b/tmodloader/module.yaml @@ -2,7 +2,7 @@ apiVersion: gameplane.local/module/v1 name: tmodloader displayName: tModLoader -version: 1.0.0 +version: 1.0.1 game: tmodloader categories: [Sandbox, Survival, Adventure, Modded] summary: tModLoader dedicated server for modded Terraria gameplay with PTY console, .tmod mod manager, and world saves. diff --git a/tmodloader/specs.md b/tmodloader/specs.md index 140e4ba..a0ffa8a 100644 --- a/tmodloader/specs.md +++ b/tmodloader/specs.md @@ -73,7 +73,7 @@ Declared ports under `spec.ports`: ## 8. Key Invariants & Security - **Wake-On-Traffic**: Declares `wakeProtocol: terraria` under `spec.ports[game]`. -- **Readiness Probe**: Uses TCP probe on port `7777`. +- **No Readiness Probe**: The template declares no probe. Like vanilla Terraria, the server crashes (`ObjectDisposedException` in `Netplay.ServerLoop`) when a client connects and closes at once, which is exactly what a kubelet `tcpSocket` probe does. --- diff --git a/tmodloader/template.yaml b/tmodloader/template.yaml index 6ec4809..89d48ca 100644 --- a/tmodloader/template.yaml +++ b/tmodloader/template.yaml @@ -53,14 +53,6 @@ spec: consoleMode: pty - probes: - readiness: - tcpSocket: - port: game - initialDelaySeconds: 30 - periodSeconds: 10 - failureThreshold: 30 - capabilities: lifecycle: stop: ["exit"] From d9f67c873e86fb9935da469d8fdf078459b24026 Mon Sep 17 00:00:00 2001 From: valgulnecron <39313199+ValgulNecron@users.noreply.github.com> Date: Mon, 5 Oct 2026 03:32:51 +0200 Subject: [PATCH 2/2] fix(terraria,tmodloader): probe readiness from /proc/net/tcp instead of dropping it Removing the readiness probe stopped the crash loop but left the pod Ready before the server could take players. Bring the probe back as an exec probe that reads /proc/net/tcp for a socket LISTENing on 7777 (0x1E61): it never opens a connection, so it cannot trigger the ObjectDisposedException that the kubelet's tcpSocket connect-and-close caused. Verified on kubelab: a vanilla server with this probe stayed Ready for 6.5 minutes with 0 restarts and no connection in its log (the tcpSocket probe gave 5 restarts in 6 minutes); the probe returns 0 for port 7777 and 1 for 7778; the tModLoader image has sh, grep -E and /proc/net/tcp{,6}. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01NsN6bnAMRM9XQtrTQ6KC7U Signed-off-by: valgulnecron <39313199+ValgulNecron@users.noreply.github.com> --- terraria/specs.md | 2 +- terraria/template.yaml | 11 +++++++++++ tmodloader/specs.md | 2 +- tmodloader/template.yaml | 11 +++++++++++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/terraria/specs.md b/terraria/specs.md index 4ae04c5..bf5f964 100644 --- a/terraria/specs.md +++ b/terraria/specs.md @@ -74,7 +74,7 @@ Declared ports under `spec.ports`: ## 8. Key Invariants & Security - **Network Wake Protocol**: Declares `wakeProtocol: terraria` under `spec.ports[game]` to allow wake-on-traffic. -- **No Readiness Probe**: The template declares no probe. The server crashes (`ObjectDisposedException` in `Netplay.ServerLoop`) when a client connects and closes at once, which is exactly what a kubelet `tcpSocket` probe does, so a TCP probe crash-loops the pod. +- **Readiness Probe**: An `exec` probe reads `/proc/net/tcp` for a socket listening on port `7777` (`0x1E61`). It never connects: a `tcpSocket` probe's connect-and-close crashes the server (`ObjectDisposedException` in `Netplay.ServerLoop`) and crash-loops the pod. --- diff --git a/terraria/template.yaml b/terraria/template.yaml index f33a010..babdee9 100644 --- a/terraria/template.yaml +++ b/terraria/template.yaml @@ -90,6 +90,17 @@ spec: image: passivelemon/terraria-docker:tmodloader-latest-pre # gameplane:floating loader: tmodloader + probes: + readiness: + # Ready once the server LISTENs on 7777 (0x1E61 in /proc/net/tcp). Never + # tcpSocket: the kubelet's connect-and-close crashes the server + # (ObjectDisposedException in Netplay.ServerLoop) and crash-loops the pod. + exec: + command: ["sh", "-c", "grep -qsE ':1E61 [0-9A-F]+:[0-9A-F]{4} 0A' /proc/net/tcp /proc/net/tcp6"] + initialDelaySeconds: 30 + periodSeconds: 10 + failureThreshold: 30 + capabilities: lifecycle: stop: ["exit"] diff --git a/tmodloader/specs.md b/tmodloader/specs.md index a0ffa8a..1c9f64d 100644 --- a/tmodloader/specs.md +++ b/tmodloader/specs.md @@ -73,7 +73,7 @@ Declared ports under `spec.ports`: ## 8. Key Invariants & Security - **Wake-On-Traffic**: Declares `wakeProtocol: terraria` under `spec.ports[game]`. -- **No Readiness Probe**: The template declares no probe. Like vanilla Terraria, the server crashes (`ObjectDisposedException` in `Netplay.ServerLoop`) when a client connects and closes at once, which is exactly what a kubelet `tcpSocket` probe does. +- **Readiness Probe**: The same `exec` probe as vanilla Terraria: it reads `/proc/net/tcp` for a socket listening on port `7777` (`0x1E61`) instead of connecting, because a `tcpSocket` probe's connect-and-close crashes the server (`ObjectDisposedException` in `Netplay.ServerLoop`). --- diff --git a/tmodloader/template.yaml b/tmodloader/template.yaml index 89d48ca..81da7a6 100644 --- a/tmodloader/template.yaml +++ b/tmodloader/template.yaml @@ -53,6 +53,17 @@ spec: consoleMode: pty + probes: + readiness: + # Ready once the server LISTENs on 7777 (0x1E61 in /proc/net/tcp). Never + # tcpSocket: the kubelet's connect-and-close crashes the server + # (ObjectDisposedException in Netplay.ServerLoop) and crash-loops the pod. + exec: + command: ["sh", "-c", "grep -qsE ':1E61 [0-9A-F]+:[0-9A-F]{4} 0A' /proc/net/tcp /proc/net/tcp6"] + initialDelaySeconds: 30 + periodSeconds: 10 + failureThreshold: 30 + capabilities: lifecycle: stop: ["exit"]