Skip to content
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

Time to play with V8 4.6 #2688

Closed
targos opened this issue Sep 4, 2015 · 42 comments
Closed

Time to play with V8 4.6 #2688

targos opened this issue Sep 4, 2015 · 42 comments
Labels
v8 engine Issues and PRs related to the V8 dependency.

Comments

@targos
Copy link
Member

targos commented Sep 4, 2015

Now that 4.5 is on master, we can start working on the vee-eight-4.6 integration branch.
I upgraded V8 to 4.6.85.12 (https://github.com/nodejs/node/tree/vee-eight-4.6). Sadly I cannot make it to compile. Here is the error I get:

node [vee-eight-4.6] % make 
make -C out BUILDTYPE=Release V=1
make[1]: Entering directory '/home/mzasso/git/targos/node/out'
  g++ '-DV8_TARGET_ARCH_X64' '-DENABLE_DISASSEMBLER' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC' -I../deps/v8  -pthread -Wall -Wextra -Wno-unused-parameter -m64 -B/home/mzasso/git/targos/node/third_party/binutils/Linux_x64/Release/bin -fno-strict-aliasing -m64 -O3 -ffunction-sections -fdata-sections -fno-omit-frame-pointer -fdata-sections -ffunction-sections -O3 -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF /home/mzasso/git/targos/node/out/Release/.deps//home/mzasso/git/targos/node/out/Release/obj.target/v8_base/gen/debug-support.o.d.raw  -c -o /home/mzasso/git/targos/node/out/Release/obj.target/v8_base/gen/debug-support.o /home/mzasso/git/targos/node/out/Release/obj/gen/debug-support.cc
/home/mzasso/git/targos/node/out/Release/obj/gen/debug-support.cc:385:49: error: ‘kInObjectPropertiesOffset’ is not a member of ‘v8::internal::Map’
 int v8dbg_class_Map__inobject_properties__int = Map::kInObjectPropertiesOffset;
                                                 ^
deps/v8/tools/gyp/v8_base.target.mk:420: recipe for target '/home/mzasso/git/targos/node/out/Release/obj.target/v8_base/gen/debug-support.o' failed
make[1]: *** [/home/mzasso/git/targos/node/out/Release/obj.target/v8_base/gen/debug-support.o] Error 1
make[1]: Leaving directory '/home/mzasso/git/targos/node/out'
Makefile:45: recipe for target 'node' failed
make: *** [node] Error 2

I am able to compile d8 without any issue on the same version.

/cc @nodejs/v8

@targos targos added the v8 engine Issues and PRs related to the V8 dependency. label Sep 4, 2015
@indutny
Copy link
Member

indutny commented Sep 4, 2015

They broke it again! 😢

@targos
Copy link
Member Author

targos commented Sep 4, 2015

Hold on, 4.6.85.13 was just released with a fix from @ofrobots 🎉

@targos
Copy link
Member Author

targos commented Sep 4, 2015

OK it's all working on my side, here is a first CI: https://ci.nodejs.org/job/node-test-commit/501/
I did not apply any floating patch yet, something may be missing.

@ofrobots
Copy link
Contributor

ofrobots commented Sep 4, 2015

@McFarts Here's the V8 team's blog post on 4.6: http://v8project.blogspot.de/2015/08/v8-release-46.html

There are no plans that I am aware of to add shared-memory multi-threading to V8 as JavaScript is single threaded as per the language spec. Perhaps your multi-core use-cases can be addressed by the cluster module, or perhaps by workers (#2133) if/when they end up landing in Node.

@Fishrock123
Copy link
Contributor

When do you think they will enable memory sharing across cores? I need my global variables and data to be... you know.. really global :P If you know what I mean

Knowing your aforementioned use case (game server?) I think you should focus on other optimizations. You can't multi-thread that in JavaScript.

@Fishrock123
Copy link
Contributor

@McFarts Could you please ask this on stack-overflow instead? This really isn't the place for the questions you are asking.

@kkoopa
Copy link

kkoopa commented Sep 5, 2015

NAN 2.0.8 test suite passes.

@ChALkeR
Copy link
Member

ChALkeR commented Sep 10, 2015

Could you please check if #2793 works in 4.6?

@ChALkeR
Copy link
Member

ChALkeR commented Sep 18, 2015

v8 4.6.85.19 should fix #2793.

@targos
Copy link
Member Author

targos commented Sep 25, 2015

I just rebased vee-eight-4.6 on master and included the backports from 4.7 that I could:

@trevnorris
Copy link
Contributor

This ready for a CI run?

@targos
Copy link
Member Author

targos commented Sep 26, 2015

@targos
Copy link
Member Author

targos commented Sep 26, 2015

... the .gitignore trolled me again: https://github.com/nodejs/node/blob/master/.gitignore#L26

@targos
Copy link
Member Author

targos commented Sep 26, 2015

OK now it's compiling: https://ci.nodejs.org/job/node-test-commit/675/

@targos
Copy link
Member Author

targos commented Sep 26, 2015

Looks promising. There is just one failing test on some platforms:

not ok 687 test-stringbytes-external.js
#assert.js:311
#    throw actual;
#    ^
#
#RangeError: Invalid array buffer length
#    at new ArrayBuffer (native)
#    at new Uint8Array (native)
#    at allocate (buffer.js:98:17)
#    at new Buffer (buffer.js:49:12)
#    at /home/iojs/build/workspace/node-test-commit-linux/nodes/ubuntu1404-32/test/parallel/test-stringbytes-external.js:138:5
#    at Function._throws (assert.js:293:5)
#    at Function.assert.throws (assert.js:319:11)
#    at /home/iojs/build/workspace/node-test-commit-linux/nodes/ubuntu1404-32/test/parallel/test-stringbytes-external.js:137:10
#    at Object.<anonymous> (/home/iojs/build/workspace/node-test-commit-linux/nodes/ubuntu1404-32/test/parallel/test-stringbytes-external.js:175:3)
#    at Module._compile (module.js:434:26)
  ---
  duration_ms: 1.210

@trevnorris
Copy link
Contributor

@targos That implies allocation failed. v8 chose one stupid and cryptic error message for that.

@trevnorris
Copy link
Contributor

Though that stack looks like an older Buffer implementation.

@targos
Copy link
Member Author

targos commented Sep 26, 2015

@trevnorris what do you mean ? The line numbers match with what's on master.

@trevnorris
Copy link
Contributor

@targos my bad. got implementations mixed up. But as for the test, may need to add extra conditionals in the tests to make sure allocation failure doesn't cause the test to fail. Though that would lead me to believe v8 is consuming more memory? Since it didn't fail before.

@skomski
Copy link
Contributor

skomski commented Sep 26, 2015

The problem it seems is that v8 4.6> doesn't initiate a mark-sweep and then simply fails the allocation.
Added some console.log(process.memoryUsage()); between the buffer allocations in the test.

./node_v45 --trace_gc test/parallel/test-stringbytes-external
[20822:0x2524d30]       31 ms: Scavenge 2.1 (38.0) -> 1.8 (38.0) MB, 0.4 / 0 ms [allocation failure].
[20822:0x2524d30]       31 ms: Scavenge 2.1 (38.0) -> 2.1 (39.0) MB, 0.4 / 0 ms [allocation failure].
[20822:0x2524d30]       60 ms: Scavenge 3.6 (39.0) -> 3.4 (40.0) MB, 0.4 / 0 ms [allocation failure].
[20822:0x2524d30]      161 ms: Scavenge 24.4 (59.1) -> 25.1 (60.1) MB, 1.6 / 0 ms [allocation failure].
[20822:0x2524d30]      161 ms: Scavenge 25.1 (60.1) -> 24.1 (61.1) MB, 0.7 / 0 ms [allocation failure].
[20822:0x2524d30]      231 ms: Scavenge 28.1 (61.1) -> 26.1 (61.1) MB, 0.3 / 0 ms [allocation failure].
[20822:0x2524d30]      253 ms: Scavenge 28.1 (61.1) -> 26.1 (61.1) MB, 0.2 / 0 ms [allocation failure].
{ rss: 74768384, heapTotal: 46019072, heapUsed: 37913336 }
[20822:0x2524d30]      329 ms: Mark-sweep 36.5 (72.1) -> 4.0 (43.0) MB, 4.2 / 0 ms [external memory allocation limit reached.] [GC in old space requested].
{ rss: 53116928, heapTotal: 24742400, heapUsed: 4239352 }
[20822:0x2524d30]      334 ms: Mark-sweep 4.1 (43.0) -> 4.0 (42.0) MB, 3.0 / 0 ms [external memory allocation limit reached.] [GC in old space requested].
{ rss: 45105152, heapTotal: 23710464, heapUsed: 4229864 }
[20822:0x2524d30]      337 ms: Mark-sweep 4.1 (42.0) -> 4.0 (42.0) MB, 2.4 / 0 ms [external memory allocation limit reached.] [GC in old space requested].
[20822:0x2524d30]      397 ms: Mark-sweep 4.0 (42.0) -> 3.7 (42.0) MB, 2.7 / 0 ms [external memory allocation limit reached.] [GC in old space requested].
[20822:0x2524d30]      401 ms: Mark-sweep 3.7 (42.0) -> 3.7 (42.0) MB, 2.2 / 0 ms [external memory allocation limit reached.] [GC in old space requested].
./node_v46 --trace_gc test/parallel/test-stringbytes-external
[20789:0x1319c10]       30 ms: Scavenge 2.1 (38.0) -> 1.9 (38.0) MB, 0.4 / 0 ms [allocation failure].
[20789:0x1319c10]       30 ms: Scavenge 2.1 (38.0) -> 2.1 (39.0) MB, 0.4 / 0 ms [allocation failure].
[20789:0x1319c10]       57 ms: Scavenge 3.6 (39.0) -> 3.3 (40.0) MB, 0.4 / 0 ms [allocation failure].
[20789:0x1319c10]      160 ms: Scavenge 24.4 (59.1) -> 25.1 (60.1) MB, 1.6 / 0 ms [allocation failure].
[20789:0x1319c10]      161 ms: Scavenge 25.1 (60.1) -> 24.1 (61.1) MB, 0.7 / 0 ms [allocation failure].
[20789:0x1319c10]      232 ms: Scavenge 28.1 (61.1) -> 26.1 (61.1) MB, 0.3 / 0 ms [allocation failure].
[20789:0x1319c10]      254 ms: Scavenge 28.2 (61.1) -> 26.2 (61.1) MB, 0.2 / 0 ms [allocation failure].
{ rss: 74747904, heapTotal: 46019072, heapUsed: 37971792 }
{ rss: 75018240, heapTotal: 47038976, heapUsed: 38365864 }
{ rss: 75018240, heapTotal: 47038976, heapUsed: 38394200 }
assert.js:311
    throw actual;
    ^

RangeError: Invalid array buffer length
    at new ArrayBuffer (native)
    at new Uint8Array (native)
    at allocate (buffer.js:98:17)
    at new Buffer (buffer.js:49:12)
    at /home/skomski/Code/node/test/parallel/test-stringbytes-external.js:145:5
    at Function._throws (assert.js:293:5)
    at Function.assert.throws (assert.js:319:11)
    at /home/skomski/Code/node/test/parallel/test-stringbytes-external.js:144:10
    at Object.<anonymous> (/home/skomski/Code/node/test/parallel/test-stringbytes-external.js:182:3)
    at Module._compile (module.js:434:26)
[1]    20789 exit 1     ./node_v46 --trace_gc test/parallel/test-stringbytes-external

@targos
Copy link
Member Author

targos commented Sep 26, 2015

It may be related to the fact that 31450fc and 2b8a06b are not on this branch. Problem is that I cannot apply @indutny's patches nor the ones from v8.

@trevnorris
Copy link
Contributor

@targos Do those two commits live on 4.7?

@targos
Copy link
Member Author

targos commented Sep 26, 2015

Yes but with a different diff. See for example 2b8a06b vs v8/v8@0d01728.
I tried to mimic the changes manually but it doesn't work...

@skomski
Copy link
Contributor

skomski commented Sep 26, 2015

Already tested with vanilla v8 4.7 master with the same result as the custom v4.6 branch.

@targos
Copy link
Member Author

targos commented Sep 29, 2015

@indutny do you know if we need to have 31450fc 2b8a06b in 4.6 ? If so, can we easily do it ?

@indutny
Copy link
Member

indutny commented Sep 29, 2015

@targos yeah, we need them. I can backport them by hand. Do you want me to do it?

@targos
Copy link
Member Author

targos commented Sep 29, 2015

Yes please. I tried to do it but had compilation issues. You will probably know what to do more than me since you wrote the original patches.

@indutny
Copy link
Member

indutny commented Sep 29, 2015

Pushed two commits to vee-eight-4.6.

@bnoordhuis
Copy link
Member

Without review? The Reviewed-By tags are lies now.

@indutny
Copy link
Member

indutny commented Sep 29, 2015

@bnoordhuis this is a staging branch, right? I suppose someone will add them when merging to real branch

@ofrobots
Copy link
Contributor

IMO, it would be better to do reviews on vee-eight-* branches too. This improves collaboration and makes it much faster to land on master when the the merge time comes.

@indutny
Copy link
Member

indutny commented Sep 29, 2015

@ofrobots well, all previous commits wasn't reviewed, so I did it the same way as it was.

@indutny
Copy link
Member

indutny commented Sep 29, 2015

Guess we may put comments on commits.

@targos
Copy link
Member Author

targos commented Sep 29, 2015

I agree that it would be better to have a proper review process for vee-eight-* branches. There are a few situations that we need to decide how to deal with:

Initiate the branch

I suggest to cut it from master after the previous one has been merged and start with a PR to upgrade V8 to the next version.

Keep the branch up to date with master

Do we merge master into it or do we regularly rebase on master ? I am for the second option but in this case how do we review a conflicting rebase ?

Keep V8 up to date in the branch

The beta branch of V8 usually has updates more often than the stable one. Do we make a PR for each one of them ?

@ofrobots
Copy link
Contributor

Do we merge master into it or do we regularly rebase on master ? I am for the second option but in this case how do we review a conflicting rebase ?

I'd vote for rebase as well. See also previous discussion for the 4.5 branch. If there is a commit added to resolve a conflict during rebase, that gets reviewed as well.

The beta branch of V8 usually has updates more often than the stable one. Do we make a PR for each one of them ?

I don't think we have to have a PR for each one of them. I don't think the goal is to review V8 changes but rather to review us picking up those changes at whatever frequency makes sense for us.

targos added a commit to targos/node that referenced this issue Oct 2, 2015
On case insensitive platforms, the rule catches the debug module under
npm and eslint and a source directory in next versions of V8.
Do the same with the Release directory for consistency.

Ref: nodejs#2286 (comment)
Ref: nodejs#2688 (comment)
PR-URL: nodejs#3144
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
@targos
Copy link
Member Author

targos commented Oct 5, 2015

Rebased on master, updated V8 to 4.6.85.23 and cherry-picked all backports.
CI: https://ci.nodejs.org/job/node-test-commit/725/

@targos
Copy link
Member Author

targos commented Oct 5, 2015

794 - test-util-inspect.js

not ok 794 test-util-inspect.js
# 
# undefined:1
# [Debug, ObjectIsPromise]
# ^
# ReferenceError: ObjectIsPromise is not defined
# at <anonymous>:1:9

@bnoordhuis It seems that ObjectIsPromise isn't exposed anymore in debug context :(

@evanlucas
Copy link
Contributor

We could use v8::Value::IsPromise like #3119 is for Map/SetIterator

@mgol
Copy link
Contributor

mgol commented Oct 13, 2015

Chrome 46 is out so V8 4.6 is now stable.

@targos
Copy link
Member Author

targos commented Oct 14, 2015

V8 4.6 is now on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

No branches or pull requests

12 participants