From 8dc9032ef617bf0b376e4eb2ecda911e3cbf8b15 Mon Sep 17 00:00:00 2001 From: Robert Gingras Date: Fri, 31 Jul 2026 15:43:34 -0400 Subject: [PATCH] fix(create-a-container): raise default container maxmem to 8GB Interactive dev boxes (code-server + extension host + a Vite dev server) realistically need ~6GB. The 4GB default was too tight and was the root cause of memory-exhaustion thrash: a container could hold ~3.6GB of unswappable anon memory against its 4GB cgroup limit while the node had ample headroom. Bump the canonical default (RESOURCE_DEFAULTS.memory) to 8192 and source the creation-time fallbacks in create-container.js from RESOURCE_DEFAULTS so the default lives in one place. Mirror the value in the dummy node seed and the client-side display defaults. Per-user/template overrides still take precedence; swap stays 0. Closes #432 --- create-a-container/bin/create-container.js | 9 +++++---- .../src/components/containers/ResourcesSection.tsx | 2 +- .../src/pages/resource-requests/MyRequestsPage.tsx | 2 +- .../src/pages/resource-requests/ResourceRequestsPage.tsx | 2 +- create-a-container/models/resourcerequest.js | 2 +- create-a-container/utils/dummy-api.js | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/create-a-container/bin/create-container.js b/create-a-container/bin/create-container.js index df28ee7e..37740deb 100755 --- a/create-a-container/bin/create-container.js +++ b/create-a-container/bin/create-container.js @@ -243,10 +243,11 @@ async function main() { container.hostname, container.username, ); - const cores = approvedResources.cpus || 4; - const memory = approvedResources.memory || 4096; - const swap = approvedResources.swap || 0; - const rootfsSize = approvedResources.rootfs || 50; + const { RESOURCE_DEFAULTS } = ResourceRequest; + const cores = approvedResources.cpus || RESOURCE_DEFAULTS.cpus; + const memory = approvedResources.memory || RESOURCE_DEFAULTS.memory; + const swap = approvedResources.swap || RESOURCE_DEFAULTS.swap; + const rootfsSize = approvedResources.rootfs || RESOURCE_DEFAULTS.rootfs; console.log(`Resources: cores=${cores}, memory=${memory}MB, swap=${swap}MB, rootfs=${rootfsSize}GB`); const isDocker = isDockerImage(container.template); diff --git a/create-a-container/client/src/components/containers/ResourcesSection.tsx b/create-a-container/client/src/components/containers/ResourcesSection.tsx index 1477194b..a69f0533 100644 --- a/create-a-container/client/src/components/containers/ResourcesSection.tsx +++ b/create-a-container/client/src/components/containers/ResourcesSection.tsx @@ -46,7 +46,7 @@ const RESOURCE_OPTIONS = [ }, ] as const; -const DEFAULTS: EffectiveResources = { memory: 4096, swap: 0, cpus: 4, rootfs: 50 }; +const DEFAULTS: EffectiveResources = { memory: 8192, swap: 0, cpus: 4, rootfs: 50 }; interface ResourcesSectionProps { siteId: string; diff --git a/create-a-container/client/src/pages/resource-requests/MyRequestsPage.tsx b/create-a-container/client/src/pages/resource-requests/MyRequestsPage.tsx index 201d6f90..4c439abe 100644 --- a/create-a-container/client/src/pages/resource-requests/MyRequestsPage.tsx +++ b/create-a-container/client/src/pages/resource-requests/MyRequestsPage.tsx @@ -23,7 +23,7 @@ const RESOURCE_LABELS: Record = { }; const RESOURCE_DEFAULTS: Record = { - memory: 4096, + memory: 8192, swap: 0, cpus: 4, rootfs: 50, diff --git a/create-a-container/client/src/pages/resource-requests/ResourceRequestsPage.tsx b/create-a-container/client/src/pages/resource-requests/ResourceRequestsPage.tsx index 2e57b3c7..d3787a3d 100644 --- a/create-a-container/client/src/pages/resource-requests/ResourceRequestsPage.tsx +++ b/create-a-container/client/src/pages/resource-requests/ResourceRequestsPage.tsx @@ -29,7 +29,7 @@ const RESOURCE_LABELS: Record = { }; const RESOURCE_DEFAULTS: Record = { - memory: 4096, + memory: 8192, swap: 0, cpus: 4, rootfs: 50, diff --git a/create-a-container/models/resourcerequest.js b/create-a-container/models/resourcerequest.js index dd469c8b..29744741 100644 --- a/create-a-container/models/resourcerequest.js +++ b/create-a-container/models/resourcerequest.js @@ -7,7 +7,7 @@ const { Model } = require('sequelize'); * Requests at or below these values are auto-approved for non-admin users. */ const RESOURCE_DEFAULTS = { - memory: 4096, // MB + memory: 8192, // MB swap: 0, // MB cpus: 4, rootfs: 50, // GB diff --git a/create-a-container/utils/dummy-api.js b/create-a-container/utils/dummy-api.js index f1fbd626..8b065ab5 100644 --- a/create-a-container/utils/dummy-api.js +++ b/create-a-container/utils/dummy-api.js @@ -69,7 +69,7 @@ class DummyApi { cfg = { net0: `name=eth0,hwaddr=${DummyApi._fakeMac()},ip=dhcp,bridge=${this.node.networkBridge || 'vmbr0'}`, cores: 4, - memory: 4096, + memory: 8192, rootfs: `local:vm-${vmid}-disk-0,size=50G`, }; this.configs.set(vmid, cfg);