Skip to content

Consistently hitting heap limits during optimize-vscode #7108

Closed

Description

@Tyriar
  • VSCode Version: master
  • OS Version: Ubuntu 16.04

The build server doesn't seem to be experiencing the same problem, I tried restarting and re-cloning vscode and it was the same.

$ gulp vscode-linux-x64-build-deb
...
[15:21:21] Starting 'optimize-vscode'...

<--- Last few GCs --->

   82576 ms: Mark-sweep 1031.1 (1434.8) -> 1030.9 (1434.8) MB, 744.4 / 0 ms [allocation failure] [GC in old space requested].
   83317 ms: Mark-sweep 1030.9 (1434.8) -> 1030.9 (1434.8) MB, 741.0 / 0 ms [allocation failure] [GC in old space requested].
   84076 ms: Mark-sweep 1030.9 (1434.8) -> 1030.9 (1434.8) MB, 758.3 / 0 ms [last resort gc].
   84831 ms: Mark-sweep 1030.9 (1434.8) -> 1030.9 (1434.8) MB, 755.7 / 0 ms [last resort gc].


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0xcab8d9c9e59 <JS Object>
    1: _parseMappings(aka SourceMapConsumer_parseMappings) [/home/daimms/dev/Microsoft/vscode/node_modules/concat-with-sourcemaps/node_modules/source-map/lib/source-map-consumer.js:~423] [pc=0x26dfc44e34d1] (this=0x90dba049d09 <a BasicSourceMapConsumer with map 0x26b0e916b2a9>,aStr=0x90dba04a951 <Very long string[1943]>,aSourceRoot=0x90dba049989 <String[44]: file:///home/daimms/dev/Microsoft/vsc...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
Aborted (core dumped)

Activity

  1. jrieken commented on Jun 2, 2016

    @jrieken
    Contributor

    Daniel Imms (@Tyriar) Do you run node in 32 or 64bit? The former has a heap limit of around 1GB, after that you get into GC hell

  2. added
    info-needed
    on Jun 2, 2016
  3. Tyriar commented on Jun 2, 2016

    @Tyriar
    ContributorAuthor

    Johannes Rieken (@jrieken) not sure, sounds reasonable though. I'll check it out when I'm in the office.

  4. Tyriar commented on Jun 6, 2016

    @Tyriar
    ContributorAuthor

    Definitely 64 bit and still hitting this on my laptop after syncing:

    ~
    ❯ node
    > require('os').arch()
    'x64'
    > 
    
  5. removed
    info-needed
    on Jun 6, 2016
  6. jrieken commented on Jun 7, 2016

    @jrieken
    Contributor

    I am not they guy for optimise. Maybe João Moreno (@joaomoreno) or alexandrudima

  7. joaomoreno commented on Jun 7, 2016

    @joaomoreno
    Contributor

    Yeah I've seen this in my Linux desktop, although never in our build machines...

  8. joaomoreno commented on Jun 7, 2016

    @joaomoreno
    Contributor

    Are you on node 5.10?

  9. Tyriar commented on Jun 7, 2016

    @Tyriar
    ContributorAuthor

    João Moreno (@joaomoreno) potentially, I'll have to check. Could ./scripts/npm.sh, code.sh and/or gulp check the node version and warn on this if so?

  10. 11 remaining items

  11. Tyriar commented on Jan 18, 2017

    @Tyriar
    ContributorAuthor

    This has been happening again for me on master/Windows 10/node 6.9.2.

  12. Tyriar commented on Jan 18, 2017

    @Tyriar
    ContributorAuthor

    V8 has a strict heap limit of 1.7gb, it can be increased like so:

    node --max-old-space-size=4096 ./node_modules/gulp/bin/gulp.js watch
    gulp watch --max-old-space-size=4096 should also work

  13. Tyriar commented on Jan 18, 2017

    @Tyriar
    ContributorAuthor

    We should consider either adding this to the npm run watch script and/or adding it to the build wiki page

  14. joaomoreno commented on Jan 18, 2017

    @joaomoreno
    Contributor

    Yeah. Isidor Nikolic (@isidorn) has this too. I hit it a couple of times too.

    We should add it and inform everyone to use npm run watch instead of gulp watch.

  15. added a commit that references this issue on Jan 18, 2017
    3e418e1
  16. headmelted commented on Feb 7, 2017

    @headmelted
    Contributor

    This is still happening for me on the latest merge into my ARM builds (although it's happening for Intel 32/64 as well).

    I'm trying to tune max_old_space_size and max_new_space_size ( <-- although I'm fairly sure max_new_space_size has nothing to do with the problem ).

    Did Tyriar's commit (3e418e1) resolve this for you guys?

  17. joaomoreno commented on Feb 7, 2017

    @joaomoreno
    Contributor

    headmelted (@headmelted) Yes, make sure you use npm run watch.

  18. headmelted commented on Feb 9, 2017

    @headmelted
    Contributor

    Testing that out now.

    Should the package.json also be changed to use "npm run watch"?

    It's strange to me that your master builds are still running with the package.json calling "gulp watch" and mine are not, and it makes me slightly suspicious I have something else out of whack.

    In any case, I'll keep digging at this side. Thanks!

  19. joaomoreno commented on Feb 9, 2017

    @joaomoreno
    Contributor

    Should the package.json also be changed to use "npm run watch"?

    What do you mean? npm run watch will run what's defined in package.json: gulp watch --max_old_space_size=4096.

    I'll change our builds to run npm run watch. The build fails occasionally, not every time.

  20. headmelted commented on Feb 9, 2017

    @headmelted
    Contributor

    I've now got to the bottom of my issue. Tyriar's above fix solved my immediate problem, but it was still falling over, which after checking my build logs turns out to have been due the Linux packaging scripts also failing for the same reason (*-build-deb).

    In my case, I needed to increase the heap limit for building the packages, too, i.e.:

    gulp "vscode-linux-armv7l-build-deb" --silent --max_old_space_size=4096;

    It may be worth adding this to your travis script for the subsequent node child scripts, or better yet, setting the increased heap size globally for the duration of the run.

  21. Tyriar commented on Feb 9, 2017

    @Tyriar
    ContributorAuthor

    I've needed to do this on Linux when building packages recently as well, we'll probably need to make the workaround more visible.

  22. locked and limited conversation to collaborators on Nov 18, 2017
  23. added a commit that references this issue on Sep 6, 2026
    594267c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugdebtverified

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions