Skip to content

GC Mark-sweep Allocation Failure #8162

Description

@SamMorrowDrums

When I run a (fairly heavy) gulp build including babel, browserify, phantomjs, uglify etc. it fails in node 6.4.0, but not in 4.5.0, with the below.

<--- Last few GCs --->

  137934 ms: Mark-sweep 921.7 (1202.0) -> 706.9 (1166.1) MB, 443.7 / 0 ms [allocation failure] [GC in old space requested].
  138245 ms: Mark-sweep 706.9 (1166.1) -> 691.4 (1128.1) MB, 311.6 / 0 ms [allocation failure] [GC in old space requested].
  138636 ms: Mark-sweep 691.4 (1128.1) -> 688.1 (1078.1) MB, 390.3 / 0 ms [last resort gc].
  138916 ms: Mark-sweep 688.1 (1078.1) -> 688.0 (1059.1) MB, 280.2 / 0 ms [last resort gc].


<--- JS stacktrace --->

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

Security context: 0x3e3b27c9e31 <JS Object>
    1: SparseJoinWithSeparatorJS(aka SparseJoinWithSeparatorJS) [native array.js:~84] [pc=0xdefd17dfdf0] (this=0x3e3b2704189 <undefined>,w=0x1ec3efe5ba69 <JS Array[7010]>,L=7010,M=0x3e3b27b49e9 <JS Function ConvertToString (SharedFunctionInfo 0x3e3b274ef79)>,N=0x194739c58b59 <String[4]\: ,\n  >)
    2: Join(aka Join) [native array.js:143] [pc=0xdefd1894fb6] (this=0x3e3b2704189 <undefined>,w=0x1e...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [gulp]
 2: 0xfb7bfc [gulp]
 3: v8::Utils::ReportApiFailure(char const*, char const*) [gulp]
 4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [gulp]
 5: v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [gulp]
 6: v8::internal::Runtime_SparseJoinWithSeparator(int, v8::internal::Object**, v8::internal::Isolate*) [gulp]
 7: 0xdefcd40961b

I have tried using both --max-old-space-size=8192 & -–nouse-idle-notification arguments but it has not made a difference.

Activity

  1. added
    v8 engineIssues and PRs related to the V8 dependency.
    on Aug 18, 2016
  2. bnoordhuis commented on Aug 18, 2016

    @bnoordhuis
    Member

    Is there reason to believe this is an issue with node.js core and not gulp? The stack trace suggests it's simply trying to Array.prototype.join() an array that is too big.

  3. bnoordhuis commented on Aug 18, 2016

    @bnoordhuis
    Member

    For completeness, --max-old-space-size=8192 does not affect the maximum length of a JS string (which is 256 MB), -–nouse-idle-notification is a no-op.

  4. SamMorrowDrums commented on Aug 18, 2016

    @SamMorrowDrums
    Author

    Thanks, I'll have to dig into which array this is. Im interested to know
    why it's working in one node version and not another though, seems a little
    odd.

    On Thu, 18 Aug 2016, 18:14 Ben Noordhuis, notifications@github.com wrote:

    For completeness, --max-old-space-size=8192 does not affect the maximum
    length of a JS string (which is 256 MB), -–nouse-idle-notification is a
    no-op.

    —
    You are receiving this because you authored the thread.
    Reply to this email directly, view it on GitHub
    #8162 (comment), or mute
    the thread
    https://github.com/notifications/unsubscribe-auth/AElqXvKj5T_zLyBL88KVZdaCBwFkTnslks5qhJL2gaJpZM4JnrzM
    .

  5. bnoordhuis commented on Oct 7, 2016

    @bnoordhuis
    Member

    I'll go ahead and close out this issue on the assumption that it's working now and probably wasn't a node.js core issue to begin with. Let me know if I should reopen.

  6. nihp commented on Apr 28, 2020

    @nihp

    I am facing the same error archived files not worked in my real device

  7. juanita95 commented on Jan 15, 2021

    @juanita95

    Lograron resolverlo?

  8. khalyomede commented on Apr 10, 2021

    @khalyomede

    I would guess this is a gulp-plugin issue, but not very sure. Here is console output before the error:

    [10:34:55] Starting 'html'...
    [10:34:55] Starting 'css'...
    [10:34:55] Finished 'html' after 242 ms
    
    <--- Last few GCs --->
    
    [17:0x562dec733720]  1810422 ms: Mark-sweep (reduce) 1994.4 (2088.2) -> 1994.2 (2056.9) MB, 781.9 / 0.0 ms  (average mu = 0.602, current mu = 0.000) last resort GC in old space requested
    [17:0x562dec733720]  1811199 ms: Mark-sweep (reduce) 1994.2 (2056.9) -> 1993.1 (2056.7) MB, 777.2 / 0.0 ms  (average mu = 0.429, current mu = 0.000) last resort GC in old space requested
    
    
    <--- JS stacktrace --->
    
    FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

    This is my gulpfile.ts file:

    import { src, dest, parallel, watch } from "gulp";
    import pug from "gulp-pug";
    import postcss from "gulp-postcss";
    import autoprefixer from "autoprefixer";
    import tailwindcss from "tailwindcss";
    import postcssImport from "postcss-import";
    
    const html = () => src("src/pages/**/*.pug")
      .pipe(pug())
      .pipe(dest("docs"));
    
    const css = () => src("src/styles/index.css")
      .pipe(postcss([postcssImport, autoprefixer, tailwindcss]))
      .pipe(dest("docs/css"));
    
    const fonts = () => src("node_modules/@fortawesome/fontawesome-free/webfonts/*")
      .pipe(dest("docs/webfonts"));
    
    const build = parallel(html, css, fonts);
    
    const listen = () => {
      watch(["src/pages/**/*.{pug,md}", "src/layouts/*.pug"], { usePolling: true }, parallel(html));
      watch(["src/styles/index.css", "src/pages/**/*.{pug,md}", "src/layouts/*.pug"], { usePolling: true }, parallel(css));
    };
    
    export {
      build,
      listen,
    };

    The first few "listenings" do not cause this issue, I have to save my files like a dozens of time before seeing this error.

  9. ricardoprato commented on Jan 23, 2023

    @ricardoprato

    I am getting this error when running npm run dev.

    <--- Last few GCs --->
    
    [398:0x58e8740]   191182 ms: Mark-sweep 949.5 (965.9) -> 948.3 (965.9) MB, 1464.6 / 0.0 ms  (average mu = 0.153, current mu = 0.005) allocation failure; scavenge might not succeed
    [398:0x58e8740]   192901 ms: Mark-sweep 949.5 (965.9) -> 948.4 (965.9) MB, 1703.2 / 0.0 ms  (average mu = 0.077, current mu = 0.009) allocation failure; scavenge might not succeed
    
    
    <--- JS stacktrace --->
    
    FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
     1: 0xb6b850 node::Abort() [node]
     2: 0xa806a6  [node]
     3: 0xd52140 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
     4: 0xd524e7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
     5: 0xf2fbe5  [node]
     6: 0xf30ae8 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]
     7: 0xf40ff3  [node]
     8: 0xf41e68 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
     9: 0xf1c7ce v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
    10: 0xf1db97 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
    11: 0xefe0e0 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [node]
    12: 0xef56ac v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawArray(int, v8::internal::AllocationType) [node]
    13: 0xef5825 v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithFiller(v8::internal::Handle<v8::internal::Map>, int, v8::internal::Handle<v8::internal::Oddball>, v8::internal::AllocationType) [node]
    14: 0xdbac61  [node]
    15: 0xdbb747 v8::internal::Builtin_ArrayConcat(int, unsigned long*, v8::internal::Isolate*) [node]
    16: 0x16ef579  [node]
    [1]    294 IOT instruction  npm run dev

    My distro

    image

  10. AamenaSaiyed commented on Jun 28, 2023

    @AamenaSaiyed

    I have same issue in my react native app
    Please help me to resolve this

    `<--- Last few GCs --->

    [15690:0x7fa908c00000] 1252298 ms: Mark-sweep 4037.7 (4142.2) -> 4034.9 (4140.8) MB, 3001.4 / 0.1 ms (average mu = 0.309, current mu = 0.006) allocation failure scavenge might not succeed
    [15690:0x7fa908c00000] 1253777 ms: Mark-sweep 4040.8 (4143.3) -> 4039.7 (4145.5) MB, 1468.2 / 0.0 ms (average mu = 0.216, current mu = 0.007) allocation failure scavenge might not succeed

    <--- JS stacktrace --->

    FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
    1: 0x108a39665 node::Abort() (.cold.1) [/Users/imac/.nvm/versions/node/v16.20.0/bin/node]
    2: 0x1077321c9 node::Abort() [/Users/imac/.nvm/versions/node/v16.20.0/bin/node]
    3: 0x1077323ae node::OOMErrorHandler(char const*, bool) [/Users/imac/.nvm/versions/node/v16.20.0/bin/node]
    4: 0x1078a71d0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/Users/imac/.nvm/versions/node/v16.20.0/bin/node]
    5: 0x1078a7193 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/imac/.nvm/versions/node/v16.20.0/bin/node]
    6: 0x107a488e5 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/Users/imac/.nvm/versions/node/v16.20.0/bin/node]
    7: 0x107a4726c v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/imac/.nvm/versions/node/v16.20.0/bin/node]
    8: 0x107a53b10 v8::internal::Heap::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/imac/.nvm/versions/node/v16.20.0/bin/node]
    9: 0x107a53b91 v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/imac/.nvm/versions/node/v16.20.0/bin/node]
    10: 0x107a1ac3e v8::internal::FactoryBasev8::internal::Factory::NewRawTwoByteString(int, v8::internal::AllocationType) [/Users/imac/.nvm/versions/node/v16.20.0/bin/node]
    11: 0x107b5a89c v8::internal::JsonParser::MakeString(v8::internal::JsonString const&, v8::internal::Handlev8::internal::String) [/Users/imac/.nvm/versions/node/v16.20.0/bin/node]
    12: 0x107b59130 v8::internal::JsonParser::ParseJsonValue() [/Users/imac/.nvm/versions/node/v16.20.0/bin/node]
    13: 0x107b586e2 v8::internal::JsonParser::ParseJson() [/Users/imac/.nvm/versions/node/v16.20.0/bin/node]
    14: 0x10792ff15 v8::internal::Builtin_JsonParse(int, unsigned long*, v8::internal::Isolate*) [/Users/imac/.nvm/versions/node/v16.20.0/bin/node]
    15: 0x108181579 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/Users/imac/.nvm/versions/node/v16.20.0/bin/node]
    16: 0x10c7b113e
    17: 0x10814387f Builtins_AsyncFunctionAwaitResolveClosure [/Users/imac/.nvm/versions/node/v16.20.0/bin/node]
    error Command failed with signal "SIGABRT".
    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`

  11. JanaganSaravanan commented on Jan 18, 2024

    @JanaganSaravanan

    For the above error, this worked for me. NODE_OPTIONS="--max_old_space_size=4096" yarn start or NODE_OPTIONS="--max_old_space_size=4096" your_script.js.

  12. niranjan404 commented on Jan 20, 2024

    @niranjan404

    I just installed https://www.npmjs.com/package/react-joyride and tried pushing to pipelines, getting this error. why?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    v8 engineIssues and PRs related to the V8 dependency.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions