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

build: re-enable V8 snapshots #1663

Closed
wants to merge 1 commit into from

Conversation

trevnorris
Copy link
Contributor

Fixes: #1631

R=@bnoordhuis

@@ -581,7 +582,7 @@ def configure_arm(o):

# Print warning when snapshot is enabled and building on armv6
if is_arch_armv6() and options.with_snapshot:
Copy link
Member

Choose a reason for hiding this comment

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

options.unused_with_snapshot? Or maybe revert the rename.

Copy link
Member

Choose a reason for hiding this comment

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

On second thought: not options.with_snapshot is probably more accurate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

remind me, did you want me to disable snapshots by default for armv6?

Copy link
Member

Choose a reason for hiding this comment

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

Good question. Maybe enable it, remove the warning and see what the CI says?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will try.

@brendanashworth brendanashworth added the build Issues and PRs related to build files or the CI. label May 8, 2015
# Print warning when snapshot is enabled and building on armv6
if is_arch_armv6() and options.with_snapshot:
warn('when building on ARMv6, don\'t use --with-snapshot')

Copy link
Contributor

Choose a reason for hiding this comment

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

The default is still to build without snapshot, right? I'm sorry, but the diff doesn't make it obvious for me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The new commit is to test CI and see if building/testing on armv6 w/ snapshot enabled works. It's just a test commit for the CI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bnoordhuis I noticed on the CI job that there's no armv6 listed. Just armv7/8. So this config optin would be tested, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

pi1-raspbian-wheezy at least is armv6.

@rvagg can we get those RPis renamed at some point to follow the naming schema arch-distro-version like the rest of the CI jobs, to avoid confusion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@silverwind ah, thanks for pointing that out. missed that one.

@trevnorris
Copy link
Contributor Author

@trevnorris
Copy link
Contributor Author

@bnoordhuis Seems armv6 build now works w/ snapshots. I'm troubleshooting the win failures, but they're not from this PR. LGTY? (well, after the squash that is)

@bnoordhuis
Copy link
Member

There are two other places in configure that use options.with_snapshot that don't seem to have been updated.

@ChALkeR
Copy link
Member

ChALkeR commented May 9, 2015

This also sligthly decreases the memory usage, from ~0.8 MiB to ~0.3 MiB per an empty context.
The speedup is about 10-25 times.

@piscisaureus
Copy link
Contributor

This makes building with snapshots the default again - is that intended?
The reason that snapshots are currently disabled by default is because of a security consideration.

@indutny
Copy link
Member

indutny commented May 9, 2015

@piscisaureus security consideration is no longer the case with a newer v8, this is why we revert that change.

@ChALkeR
Copy link
Member

ChALkeR commented May 9, 2015

For the simple repeated (async) «var x = {}; vm.createContext(x);» test RSS with this patch does not reach 1.4 GiB now (as it did before), but stays around ~700 MiB (~800 MiB peak), heapUsed does not go above 480 MiB (was at least 880 MiB without this patch). That's still not perfect, but a bit better than it was.

@jbergstroem
Copy link
Member

@indutny oh, I didn't know security was "fixed". Got more info on that? (bonus point for commit link :)

@ChALkeR
Copy link
Member

ChALkeR commented May 10, 2015

@jbergstroem The discussion was at the issue this pr fixes: #1631 (comment)

@trevnorris
Copy link
Contributor Author

@bnoordhuis don't see the two places you're talking about. I see:

  o['variables']['v8_use_snapshot'] = b(options.with_snapshot)

Which is correct, since snapshot will have been enabled. And:

  if target_arch != host_arch and options.with_snapshot:
    o['variables']['want_separate_host_toolset'] = 1
  else:
    o['variables']['want_separate_host_toolset'] = 0

Which I believe is still correct because want_separate_host_toolset should be 1 if snapshot is enabled.

@bnoordhuis
Copy link
Member

Oh, I see what I missed now... --without-snapshot is options.with_snapshot with store_false.

It's kind of confusing because AFAIK that makes it the only option that works that way. Let me go over the PR one more time.

action='store_true',
dest='unused_without_snapshot',
action='store_false',
dest='with_snapshot',
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be clearer / more idiomatic if you named it 'without_snapshot' with action='store_false' (and you can drop the default=True in that case.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you meant action='store_true'. Otherwise it'll always be false.

Copy link
Member

Choose a reason for hiding this comment

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

That is indeed what I meant. :-)

@trevnorris
Copy link
Contributor Author

@bnoordhuis Switched the variable name, and does seem to make more sense that way. PTAL.

o['variables']['want_separate_host_toolset'] = 0
else:
o['variables']['want_separate_host_toolset'] = 1
Copy link
Member

Choose a reason for hiding this comment

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

I suspect that the logic is wrong here because it will set want_separate_host_toolset = 1 when target_arch == host_arch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh you're correct. I naively switched the statements. Has been fixed.

o['variables']['want_separate_host_toolset'] = 0
else:
o['variables']['want_separate_host_toolset'] = 1
Copy link
Member

Choose a reason for hiding this comment

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

This still doesn't look quite correct me. Host/target toolsetting should be enabled when cross-compiling with snapshots enabled so I think you could write this as:

cross_compiling = target_arch != host_arch
want_snapshots = not options.without_snapshot
o['variables']['want_separate_host_toolset'] = int(cross_compiling and want_snapshots)

The double negation reads kind of iffy but it is what it is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Had to make a white space change to fit at 80, but made the change.

Also re-enable use of snapshots for armv6.

Fixes: nodejs#1631
@bnoordhuis
Copy link
Member

LGTM if the CI is happy. I would explain in the commit log that enabling snapshots is no longer a security liability.

@trevnorris
Copy link
Contributor Author

Thanks @bnoordhuis for all the reviews. Landed in 8736a8e.

@trevnorris trevnorris closed this May 11, 2015
trevnorris added a commit that referenced this pull request May 11, 2015
Snapshots had been previously disabled because of a security
vunerability. This has been fixed (ref:
#1631 (comment))

Also, re-enable snapshots for ARMv6 builds. There were previous build
issues that have been fixed.

Fixes: #1631
PR-URL: #1663
Reviewed-By: Ben Noordhuis <[email protected]>
@trevnorris
Copy link
Contributor Author

Edit: Actually landed in 36cdc7c.

Fishrock123 added a commit to Fishrock123/node that referenced this pull request May 15, 2015
PR-URL: nodejs#1679

Notable Changes:

* win,node-gyp: the delay-load hook for windows addons has now been
correctly enabled by default, it had wrongly defaulted to off in the
release version of 2.0.0 (Bert Belder) nodejs#1433
* os: tmpdir()'s trailing slash stripping has been refined to fix an
issue when the temp directory is at '/'. Also considers which slash is
used by the operating system. (cjihrig) nodejs#1673
* tls: default ciphers have been updated to use gcm and aes128 (Mike
MacCana) nodejs#1660
* build: v8 snapshots have been re-enabled by default as suggested by
the v8 team, since prior security issues have been resolved. This
should give some perf improvements to both startup and vm context
creation. (Trevor Norris) nodejs#1663
* src: fixed preload modules not working when other flags were used
before --require (Yosuke Furukawa) nodejs#1694
* dgram: fixed send()'s callback not being asynchronous (Yosuke
Furukawa) nodejs#1313
* readline: emitKeys now keeps buffering data until it has enough to
parse. This fixes an issue with parsing split escapes. (Alex Kocharin)
* cluster: works now properly emit 'disconnect' to cluser.worker (Oleg
Elifantiev) nodejs#1386
events: uncaught errors now provide some context (Evan Lucas) nodejs#1654
Fishrock123 pushed a commit to Fishrock123/node that referenced this pull request May 19, 2015
Snapshots had been previously disabled because of a security
vunerability. This has been fixed (ref:
nodejs#1631 (comment))

Also, re-enable snapshots for ARMv6 builds. There were previous build
issues that have been fixed.

Fixes: nodejs#1631
PR-URL: nodejs#1663
Reviewed-By: Ben Noordhuis <[email protected]>
@trevnorris trevnorris deleted the reenable-snapshots branch March 28, 2016 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Slow vm.runInNewContext()
9 participants