Skip to content

Conversation

@geemanjs
Copy link
Contributor

@geemanjs geemanjs commented Dec 3, 2025

Summary

Moves to use process.constrainedMemory instead of os.totalmem() for determinig total available memory. According to the docs since Node 22 it backs off to uv_get_constrained_memory in libuv which means it should lookup from cgroups when available.

⚠️ Worth noting that if no limit or constraint is set on the container we revert back to looking up the host value as this is the "theoretical max"

Also adds an accordion section with other memory stats in it to give a better picture.

Changes the free memory chart to a more useful Memory usage (%) one.

Will raise a follow up ticket for this PR as the workers details page has a mix of os/host, process and job information on it.

Related Linear tickets, Github issues, and Community forum

closes PAY-4106

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Dec 3, 2025
@bundlemon
Copy link

bundlemon bot commented Dec 3, 2025

BundleMon

Unchanged files (2)
Status Path Size Limits
WASM Dependencies
tree-sitter-bash.wasm
181.26KB -
WASM Dependencies
tree-sitter.wasm
74.47KB -

No change in files bundle size

Groups updated (2)
Status Path Size Limits
**/*.js
11.43MB (+146.88KB +1.27%) -
**/*.css
233.54KB (+12.76KB +5.78%) -

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@codecov
Copy link

codecov bot commented Dec 3, 2025

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 7 files

Prompt for AI agents (all 3 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/frontend/editor-ui/src/features/settings/orchestration.ee/components/WorkerChartsAccordion.vue">

<violation number="1" location="packages/frontend/editor-ui/src/features/settings/orchestration.ee/components/WorkerChartsAccordion.vue:88">
P1: Bug: CPU chart labels should be assigned from `newDataJobs.labels` (the newly built labels), not from `dataCPU.value.labels` (stale state). This will cause label synchronization issues between charts.</violation>

<violation number="2" location="packages/frontend/editor-ui/src/features/settings/orchestration.ee/components/WorkerChartsAccordion.vue:96">
P1: Bug: Memory chart labels should be assigned from `newDataJobs.labels` (the newly built labels), not from `dataMemoryUsage.value.labels` (stale state). This will cause label synchronization issues between charts.</violation>
</file>

<file name="packages/frontend/editor-ui/src/features/settings/orchestration.ee/components/WorkerCard.vue">

<violation number="1" location="packages/frontend/editor-ui/src/features/settings/orchestration.ee/components/WorkerCard.vue:74">
P3: Unit notation &#39;Gb&#39; should be &#39;GB&#39;. &#39;Gb&#39; means gigabits (used for data transfer rates), while &#39;GB&#39; means gigabytes (used for memory/storage). The original code correctly used &#39;GB&#39;.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

const usedMem = totalMem - item.data.process.memory.available;
const usage = (usedMem / totalMem) * 100;
newDataMemoryUsage.labels = dataMemoryUsage.value.labels;
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Bug: Memory chart labels should be assigned from newDataJobs.labels (the newly built labels), not from dataMemoryUsage.value.labels (stale state). This will cause label synchronization issues between charts.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/frontend/editor-ui/src/features/settings/orchestration.ee/components/WorkerChartsAccordion.vue, line 96:

<comment>Bug: Memory chart labels should be assigned from `newDataJobs.labels` (the newly built labels), not from `dataMemoryUsage.value.labels` (stale state). This will cause label synchronization issues between charts.</comment>

<file context>
@@ -74,22 +74,31 @@ orchestrationStore.$onAction(({ name, store }) =&gt; {
+			const usedMem = totalMem - item.data.process.memory.available;
+
+			const usage = (usedMem / totalMem) * 100;
+			newDataMemoryUsage.labels = dataMemoryUsage.value.labels;
+			newDataMemoryUsage.datasets[0].data.push(usage.toFixed(2));
 		});
</file context>
Suggested change
newDataMemoryUsage.labels = dataMemoryUsage.value.labels;
newDataMemoryUsage.labels = newDataJobs.labels;

✅ Addressed in d659c15

newDataMemory.datasets[0].data.push(maxMemory - memAsGb(item.data.freeMem));
newDataMemory.labels = newDataJobs.labels;
newDataCPU.labels = dataCPU.value.labels;
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Bug: CPU chart labels should be assigned from newDataJobs.labels (the newly built labels), not from dataCPU.value.labels (stale state). This will cause label synchronization issues between charts.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/frontend/editor-ui/src/features/settings/orchestration.ee/components/WorkerChartsAccordion.vue, line 88:

<comment>Bug: CPU chart labels should be assigned from `newDataJobs.labels` (the newly built labels), not from `dataCPU.value.labels` (stale state). This will cause label synchronization issues between charts.</comment>

<file context>
@@ -74,22 +74,31 @@ orchestrationStore.$onAction(({ name, store }) =&gt; {
-			newDataMemory.datasets[0].data.push(maxMemory - memAsGb(item.data.freeMem));
-			newDataMemory.labels = newDataJobs.labels;
+
+			newDataCPU.labels = dataCPU.value.labels;
+			const totalMem = item.data.isInContainer
+				? item.data.process.memory.constraint
</file context>
Suggested change
newDataCPU.labels = dataCPU.value.labels;
newDataCPU.labels = newDataJobs.labels;

✅ Addressed in d659c15

Average Load: {{ averageWorkerLoadFromLoadsAsString(worker.loadAvg ?? [0]) }} | Free Memory:
{{ memAsGb(worker.freeMem).toFixed(2) }}GB / {{ memAsGb(worker.totalMem).toFixed(2) }}GB
Average Load: {{ averageWorkerLoadFromLoadsAsString(worker.loadAvg ?? [0]) }} | Free memory:
{{ memAsGb(worker.process.memory.available) }}Gb /
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: Unit notation 'Gb' should be 'GB'. 'Gb' means gigabits (used for data transfer rates), while 'GB' means gigabytes (used for memory/storage). The original code correctly used 'GB'.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/frontend/editor-ui/src/features/settings/orchestration.ee/components/WorkerCard.vue, line 74:

<comment>Unit notation &#39;Gb&#39; should be &#39;GB&#39;. &#39;Gb&#39; means gigabits (used for data transfer rates), while &#39;GB&#39; means gigabytes (used for memory/storage). The original code correctly used &#39;GB&#39;.</comment>

<file context>
@@ -69,8 +70,13 @@ onBeforeUnmount(() =&gt; {
-				Average Load: {{ averageWorkerLoadFromLoadsAsString(worker.loadAvg ?? [0]) }} | Free Memory:
-				{{ memAsGb(worker.freeMem).toFixed(2) }}GB / {{ memAsGb(worker.totalMem).toFixed(2) }}GB
+				Average Load: {{ averageWorkerLoadFromLoadsAsString(worker.loadAvg ?? [0]) }} | Free memory:
+				{{ memAsGb(worker.process.memory.available) }}Gb /
+				{{
+					memAsGb(
</file context>
Suggested change
{{ memAsGb(worker.process.memory.available) }}Gb /
{{ memAsGb(worker.process.memory.available) }}GB /
Fix with Cubic

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point - updated

@currents-bot
Copy link

currents-bot bot commented Dec 4, 2025

E2E Tests: n8n tests passed after 8m 54.7s

🟢 572 · 🔴 0 · ⚪️ 37 · 🟣 3

View Run Details

Run Details

  • Project: n8n

  • Groups: 2

  • Framework: Playwright

  • Run Status: Passed

  • Commit: 68c8aab

  • Spec files: 117

  • Overall tests: 609

  • Duration: 8m 54.7s

  • Parallelization: 9

Groups

GroupId Results Spec Files Progress
multi-main:ui 🟢 518 · 🔴 0 · ⚪️ 37 · 🟣 3 109 / 109
multi-main:ui:isolated 🟢 54 · 🔴 0 · ⚪️ 0 8 / 8


This message was posted automatically by currents.dev | Integration Settings

@blacksmith-sh

This comment has been minimized.

@geemanjs geemanjs force-pushed the pay-4106-workers-are-not-container-aware branch from d659c15 to 28b62d3 Compare December 4, 2025 21:01
@geemanjs geemanjs requested review from a team and MarcL and removed request for a team December 4, 2025 21:02
@geemanjs geemanjs force-pushed the pay-4106-workers-are-not-container-aware branch from 28b62d3 to 974ff66 Compare December 5, 2025 09:57
const maxMemory = memAsGb(orchestrationStore.workers[props.workerId]?.totalMem) ?? 1;
const optionsMemory: Partial<ChartOptions<'line'>> = optionsBase();
if (optionsMemory.scales?.y) optionsMemory.scales.y.suggestedMax = maxMemory;
if (optionsMemory.scales?.y) optionsMemory.scales.y.suggestedMax = 100;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does this 100 value come from?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a percentage - so 100%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants