-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
worker: resourceLimits overridden by --max-old-space-size #43991
Comments
Alternative: introduce a new flag Use that flag to initialize the main thread's old space size. Deprecate This has the added advantage of removing a dependency on a V8 internal flag. |
If `--max-old-space-size` is passed on the command line, it takes precedence over `resourceLimits.maxOldSpaceSizeMb` passed to the worker thread. IMO this is a bug, but seems unlikely to change(?), so let's start by documenting it. See the attached issue for more details. Refs: nodejs#43991
This adds a new flag `--thread-max-old-space-size` (name completely provisional). This has two advantages over the existing `--max-old-space-size` flag: 1. It allows setting the old space size for the main thread and using `resourceLimits` for worker threads. Currently `resourceLimits` will be ignored when `--max-old-space-size` is set (see the attached issues). 2. It is implemented using V8's public API, rather than relying on V8's internal flags whose stability and functionality are not guaranteed. The downside is that there are now two flags which (in most cases) do the same thing, so it may cause some confusion. I also think that we should deprecate `--max-old-space-size`, since the semantics feel pretty error-prone, but that's a story for another day. Refs: nodejs#41066 Refs: nodejs#43991 Refs: nodejs#43992
This adds a new flag `--thread-max-old-space-size` (name completely provisional). This has two advantages over the existing `--max-old-space-size` flag: 1. It allows setting the old space size for the main thread and using `resourceLimits` for worker threads. Currently `resourceLimits` will be ignored when `--max-old-space-size` is set (see the attached issues). 2. It is implemented using V8's public API, rather than relying on V8's internal flags whose stability and functionality are not guaranteed. The downside is that there are now two flags which (in most cases) do the same thing, so it may cause some confusion. I also think that we should deprecate `--max-old-space-size`, since the semantics feel pretty error-prone, but that's a story for another day. Refs: nodejs#41066 Refs: nodejs#43991 Refs: nodejs#43992
This adds a new flag `--thread-max-old-space-size` (name completely provisional). This has two advantages over the existing `--max-old-space-size` flag: 1. It allows setting the old space size for the main thread and using `resourceLimits` for worker threads. Currently `resourceLimits` will be ignored when `--max-old-space-size` is set (see the attached issues). 2. It is implemented using V8's public API, rather than relying on V8's internal flags whose stability and functionality are not guaranteed. The downside is that there are now two flags which (in most cases) do the same thing, so it may cause some confusion. I also think that we should deprecate `--max-old-space-size`, since the semantics feel pretty error-prone, but that's a story for another day. Refs: nodejs#41066 Refs: nodejs#43991 Refs: nodejs#43992
This adds a new flag `--thread-max-old-space-size` (name completely provisional). This has two advantages over the existing `--max-old-space-size` flag: 1. It allows setting the old space size for the main thread and using `resourceLimits` for worker threads. Currently `resourceLimits` will be ignored when `--max-old-space-size` is set (see the attached issues). 2. It is implemented using V8's public API, rather than relying on V8's internal flags whose stability and functionality are not guaranteed. The downside is that there are now two flags which (in most cases) do the same thing, so it may cause some confusion. I also think that we should deprecate `--max-old-space-size`, since the semantics feel pretty error-prone, but that's a story for another day. Refs: nodejs#41066 Refs: nodejs#43991 Refs: nodejs#43992
This adds a new flag `--thread-max-old-space-size` (name completely provisional). This has two advantages over the existing `--max-old-space-size` flag: 1. It allows setting the old space size for the main thread and using `resourceLimits` for worker threads. Currently `resourceLimits` will be ignored when `--max-old-space-size` is set (see the attached issues). 2. It is implemented using V8's public API, rather than relying on V8's internal flags whose stability and functionality are not guaranteed. The downside is that there are now two flags which (in most cases) do the same thing, so it may cause some confusion. I also think that we should deprecate `--max-old-space-size`, since the semantics feel pretty error-prone, but that's a story for another day. Refs: nodejs#41066 Refs: nodejs#43991 Refs: nodejs#43992
This adds a new flag `--thread-max-old-space-size` (name completely provisional). This has two advantages over the existing `--max-old-space-size` flag: 1. It allows setting the old space size for the main thread and using `resourceLimits` for worker threads. Currently `resourceLimits` will be ignored when `--max-old-space-size` is set (see the attached issues). 2. It is implemented using V8's public API, rather than relying on V8's internal flags whose stability and functionality are not guaranteed. The downside is that there are now two flags which (in most cases) do the same thing, so it may cause some confusion. I also think that we should deprecate `--max-old-space-size`, since the semantics feel pretty error-prone, but that's a story for another day. Refs: nodejs#41066 Refs: nodejs#43991 Refs: nodejs#43992
ISTM |
On Wed, Jul 27, 2022, at 2:08 AM, Ben Noordhuis wrote:
ISTM `--max-old-space-size=<n>` should take precedence over `resourceLimits.maxOldSpaceSizeMb` when the former is smaller than the latter. It's okay for a worker to have a heap smaller than the global limit, but not bigger.
By "ISTM", do you mean that that's the behavior you would want or the current behavior? Based on my experiments above and the code, it seems that the flag completely overrides maxOldSpaceSizeMb regardless of if it's higher or lower.
Also, feel free to weigh in on #43995
|
The behavior I would like it to have / feel is the least surprising. |
If `--max-old-space-size` is passed on the command line, it takes precedence over `resourceLimits.maxOldSpaceSizeMb` passed to the worker thread. IMO this is a bug, but seems unlikely to change(?), so let's start by documenting it. See the attached issue for more details. Refs: #43991 PR-URL: #43992 Reviewed-By: James M Snell <[email protected]>
If `--max-old-space-size` is passed on the command line, it takes precedence over `resourceLimits.maxOldSpaceSizeMb` passed to the worker thread. IMO this is a bug, but seems unlikely to change(?), so let's start by documenting it. See the attached issue for more details. Refs: #43991 PR-URL: #43992 Reviewed-By: James M Snell <[email protected]>
If `--max-old-space-size` is passed on the command line, it takes precedence over `resourceLimits.maxOldSpaceSizeMb` passed to the worker thread. IMO this is a bug, but seems unlikely to change(?), so let's start by documenting it. See the attached issue for more details. Refs: nodejs#43991 PR-URL: nodejs#43992 Reviewed-By: James M Snell <[email protected]>
If `--max-old-space-size` is passed on the command line, it takes precedence over `resourceLimits.maxOldSpaceSizeMb` passed to the worker thread. IMO this is a bug, but seems unlikely to change(?), so let's start by documenting it. See the attached issue for more details. Refs: #43991 PR-URL: #43992 Reviewed-By: James M Snell <[email protected]>
If `--max-old-space-size` is passed on the command line, it takes precedence over `resourceLimits.maxOldSpaceSizeMb` passed to the worker thread. IMO this is a bug, but seems unlikely to change(?), so let's start by documenting it. See the attached issue for more details. Refs: #43991 PR-URL: #43992 Reviewed-By: James M Snell <[email protected]>
If `--max-old-space-size` is passed on the command line, it takes precedence over `resourceLimits.maxOldSpaceSizeMb` passed to the worker thread. IMO this is a bug, but seems unlikely to change(?), so let's start by documenting it. See the attached issue for more details. Refs: #43991 PR-URL: #43992 Reviewed-By: James M Snell <[email protected]>
If `--max-old-space-size` is passed on the command line, it takes precedence over `resourceLimits.maxOldSpaceSizeMb` passed to the worker thread. IMO this is a bug, but seems unlikely to change(?), so let's start by documenting it. See the attached issue for more details. Refs: #43991 PR-URL: #43992 Reviewed-By: James M Snell <[email protected]>
If `--max-old-space-size` is passed on the command line, it takes precedence over `resourceLimits.maxOldSpaceSizeMb` passed to the worker thread. IMO this is a bug, but seems unlikely to change(?), so let's start by documenting it. See the attached issue for more details. Refs: #43991 PR-URL: #43992 Reviewed-By: James M Snell <[email protected]>
If `--max-old-space-size` is passed on the command line, it takes precedence over `resourceLimits.maxOldSpaceSizeMb` passed to the worker thread. IMO this is a bug, but seems unlikely to change(?), so let's start by documenting it. See the attached issue for more details. Refs: #43991 PR-URL: #43992 Reviewed-By: James M Snell <[email protected]>
If `--max-old-space-size` is passed on the command line, it takes precedence over `resourceLimits.maxOldSpaceSizeMb` passed to the worker thread. IMO this is a bug, but seems unlikely to change(?), so let's start by documenting it. See the attached issue for more details. Refs: nodejs/node#43991 PR-URL: nodejs/node#43992 Reviewed-By: James M Snell <[email protected]>
If `--max-old-space-size` is passed on the command line, it takes precedence over `resourceLimits.maxOldSpaceSizeMb` passed to the worker thread. IMO this is a bug, but seems unlikely to change(?), so let's start by documenting it. See the attached issue for more details. Refs: nodejs/node#43991 PR-URL: nodejs/node#43992 Reviewed-By: James M Snell <[email protected]>
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 takesprecedence over
resourceLimits.maxOldSpaceSizeMb
passed to the workerthread.
It seems to come from this code in V8:
node/deps/v8/src/heap/heap.cc
Line 5204 in 5fad0b9
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.
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
overridesresourceLimits.maxOldSpaceSizeMb
.Additional information
No response
The text was updated successfully, but these errors were encountered: