carlos / platform Public

host: an unreadable serving unit's cgroup is no size in force, not the slice's

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev a04a05e81d9fb7f99ca3d14f26600e2f1a55437b parent 8388bf6
1 file changed, +13 −0
  • internal/host/sizestatus_test.go +13 −0
diff --git a/internal/host/sizestatus_test.go b/internal/host/sizestatus_test.go
index f1e4339a6..aa6e70272 100644
--- a/internal/host/sizestatus_test.go
+++ b/internal/host/sizestatus_test.go
@@ -122,6 +122,19 @@ func TestReadSizeInForcePrefersTheServingUnit(t *testing.T) {
t.Errorf("%s: readSizeInForce = %q, true; want false", h, got.Name)
}
}
+
+ // A serving unit whose cgroup exists but whose memory.max is missing or
+ // malformed is unreadable, not the slice's size: the slice holds a
+ // valid row (xlarge) and the answer is still false.
+ if err := os.MkdirAll(filepath.Join(slice, instancectl.GenUnitName(host, 5)), 0o755); err != nil {
+ t.Fatal(err)
+ }
+ writeMemoryMax(t, filepath.Join(slice, instancectl.GenUnitName(host, 6)), "not-a-number")
+ for _, gen := range []uint64{5, 6} {
+ if got, ok := readSizeInForce(root, host, gen); ok {
+ t.Errorf("unreadable unit gen %d: readSizeInForce = %q, true; want false, not the slice's size", gen, got.Name)
+ }
+ }
}
// nestedRoute and flatRoute are activator-managed rows the layout pass