Skip to content

worker: resourceLimits overridden by --max-old-space-size #43991

Open
@kvakil

Description

@kvakil

Version

v19.0.0-pre (and earlier)

Platform

Linux sylph 5.4.0-56-generic # 62-Ubuntu SMP Mon Nov 23 19:20:19 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

worker

What steps will reproduce the bug?

If --max-old-space-size is passed on the command line, it takes
precedence over resourceLimits.maxOldSpaceSizeMb passed to the worker
thread.

It seems to come from this code in V8:

if (FLAG_max_old_space_size > 0) {

You can repro by modifying test/parallel/test-worker-resource-limits.js.
Adding a value for--max-old-space-size here (even if it is the default)
causes the test to fail.

diff --git a/test/parallel/test-worker-resource-limits.js b/test/parallel/test-worker-resource-limits.js
index f79c31b2a1..1f394eaa4a 100644
--- a/test/parallel/test-worker-resource-limits.js
+++ b/test/parallel/test-worker-resource-limits.js
@@ -1,3 +1,4 @@
+// Flags: --max-old-space-size=1000
 'use strict';
 const common = require('../common');
 const assert = require('assert');

I feel this is unintuitive and should be changed upstream, but it should
definitely be documented in NodeJS too.

How often does it reproduce? Is there a required condition?

always

What is the expected behavior?

resourceLimits.maxOldSpaceSizeMb should override --max-old-space-size.

What do you see instead?

--max-old-space-size overrides resourceLimits.maxOldSpaceSizeMb.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    workerIssues and PRs related to Worker support.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions