Skip to content

Conversation

@danbev
Copy link
Contributor

Original commit message:

[heap] Add large_object_threshold to AllocateRaw

This commit adds a check in Heap::AllocateRaw when setting the
large_object variable, when the AllocationType is of type kCode, to
take into account the size of the CodeSpace's area size.

The motivation for this change is that without this check it is
possible that size_in_bytes is less than 128, and hence not considered
a large object, but it might be larger than the available space
in code_space->AreaSize(), which will cause the object to be created
in the CodeLargeObjectSpace. This will later cause a segmentation fault
when calling the following chain of functions:

 if (!large_object){MemoryChunk::FromHeapObject(heap_object) ->GetCodeObjectRegistry() ->RegisterNewlyAllocatedCodeObject(heap_object.address())} 

We (Red Hat) ran into this issue when running Node.js v12.16.1 in
combination with yarn on aarch64 (this was the only architecture that
this happed on).

Bug: v8:10808
Change-Id: I0c396b0eb64bc4cc91d9a3be521254f3130eac7b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2390665
Commit-Queue: Ulan Degenbaev [email protected]
Reviewed-by: Ulan Degenbaev [email protected]
Cr-Commit-Position: refs/heads/master@{#69876}

Refs: v8/v8@7173685

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-botnodejs-github-bot added build Issues and PRs related to build files or the CI. v12.x v8 engine Issues and PRs related to the V8 dependency. labels Sep 15, 2020
@yselkowitz
Copy link

Is there a PR for 14 as well?

@danbev
Copy link
ContributorAuthor

Is there a PR for 14 as well?

Not yet, but I'll create one tomorrow.

@targos
Copy link
Member

If this applies to the V8 version we have in master/v14.x, please only open a PR against master. It can then be backported to v12.x

@danbev
Copy link
ContributorAuthor

danbev commented Sep 15, 2020

If this applies to the V8 version we have in master/v14.x, please only open a PR against master.

I can create a PR against master tomorrow 👍
The reason for opening this PR is that the patch needed some modifications to apply against the V8 version in 12.

@danbevdanbevforce-pushed the deps-v8-heap-allocateraw branch 2 times, most recently from 982be1f to c012d6dCompareSeptember 16, 2020 04:46
@danbev
Copy link
ContributorAuthor

@danbevdanbevforce-pushed the deps-v8-heap-allocateraw branch from af49418 to 2cdb60dCompareSeptember 22, 2020 10:05
@danbev
Copy link
ContributorAuthor

@addaleax
Copy link
Member

@danbev Sorry to ask, but could you rebase this?

@danbev
Copy link
ContributorAuthor

@danbev Sorry to ask, but could you rebase this?

No worries, I'll rebase shortly.

Original commit message: [heap] Add large_object_threshold to AllocateRaw This commit adds a check in Heap::AllocateRaw when setting the large_object variable, when the AllocationType is of type kCode, to take into account the size of the CodeSpace's area size. The motivation for this change is that without this check it is possible that size_in_bytes is less than 128, and hence not considered a large object, but it might be larger than the available space in code_space->AreaSize(), which will cause the object to be created in the CodeLargeObjectSpace. This will later cause a segmentation fault when calling the following chain of functions: if (!large_object){MemoryChunk::FromHeapObject(heap_object) ->GetCodeObjectRegistry() ->RegisterNewlyAllocatedCodeObject(heap_object.address())} We (Red Hat) ran into this issue when running Node.js v12.16.1 in combination with yarn on aarch64 (this was the only architecture that this happed on). Bug: v8:10808 Change-Id: I0c396b0eb64bc4cc91d9a3be521254f3130eac7b Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2390665 Commit-Queue: Ulan Degenbaev <[email protected]> Reviewed-by: Ulan Degenbaev <[email protected]> Cr-Commit-Position: refs/heads/master@{#69876} Refs: v8/v8@7173685
@danbevdanbevforce-pushed the deps-v8-heap-allocateraw branch from 2cdb60d to 11a0593CompareSeptember 23, 2020 03:27
@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Sep 23, 2020

@richardlau
Copy link
Member

@danbev looks like the V8 CI fails for this PR.

@danbev
Copy link
ContributorAuthor

@richardlau Thanks again! And sorry about using CI instead of testing locally but I'm running low on disk space on my machine.

@richardlaurichardlau added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 23, 2020
@danbev
Copy link
ContributorAuthor

@github-actionsgithub-actionsbot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 23, 2020
@nodejs-github-bot
Copy link
Collaborator

@addaleax
Copy link
Member

Landed in 57564eb

addaleax pushed a commit that referenced this pull request Sep 23, 2020
Original commit message: [heap] Add large_object_threshold to AllocateRaw This commit adds a check in Heap::AllocateRaw when setting the large_object variable, when the AllocationType is of type kCode, to take into account the size of the CodeSpace's area size. The motivation for this change is that without this check it is possible that size_in_bytes is less than 128, and hence not considered a large object, but it might be larger than the available space in code_space->AreaSize(), which will cause the object to be created in the CodeLargeObjectSpace. This will later cause a segmentation fault when calling the following chain of functions: if (!large_object){MemoryChunk::FromHeapObject(heap_object) ->GetCodeObjectRegistry() ->RegisterNewlyAllocatedCodeObject(heap_object.address())} We (Red Hat) ran into this issue when running Node.js v12.16.1 in combination with yarn on aarch64 (this was the only architecture that this happed on). Bug: v8:10808 Change-Id: I0c396b0eb64bc4cc91d9a3be521254f3130eac7b Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2390665 Commit-Queue: Ulan Degenbaev <[email protected]> Reviewed-by: Ulan Degenbaev <[email protected]> Cr-Commit-Position: refs/heads/master@{#69876} Refs: v8/v8@7173685 PR-URL: #35205 Reviewed-By: Anna Henningsen <[email protected]>
@codebyterecodebytere mentioned this pull request Sep 28, 2020
@kasicka
Copy link

Was this backported to v14 as well?

@mhdawson
Copy link
Member

@kasicka looks like it was in #36074

@yselkowitz
Copy link

But that PR was closed without being merged?

@yselkowitz
Copy link

I can confirm that 14.15.4 does not contain the fix.

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

Labels

buildIssues and PRs related to build files or the CI.v8 engineIssues and PRs related to the V8 dependency.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@danbev@yselkowitz@targos@addaleax@nodejs-github-bot@richardlau@kasicka@mhdawson