Skip to content

JavaScript heap out of memory errors after upgrading 1.7.1 -> 1.8.0 #3679

@jpalo

Description

@jpalo

Category

  • Question
  • Typo
  • Bug
  • Additional article idea

Expected or Desired Behavior

No memory errors when building and working with the code in SP Online workbench.

Observed Behavior

Upgraded from 1.7.1 to 1.8.0 and started seeing this in my project. Occurs every 3-4th time I modify file & save, which triggers build. As you can see, when the issue occurs on the copy-assets step, webpack step takes long (1 min in this case, also had it occur just now with 26 secs runtime). When it doesn't fail, webpack step only takes 6-11 secs.

[15:21:39] [tslint] tslint version: 5.12.1
[15:21:39] Starting subtask 'tsc'...
[15:21:39] [tsc] typescript version: 3.3.4000
[15:21:39] Finished subtask 'copy-static-assets' after 179 ms
[15:21:46] Finished subtask 'tsc' after 7.75 s
[15:21:46] Finished subtask 'tslint' after 7.76 s
[15:21:46] Starting subtask 'post-copy'...
[15:21:46] Finished subtask 'post-copy' after 562 μs
[15:21:46] Starting subtask 'collectLocalizedResources'...
[15:21:46] Finished subtask 'collectLocalizedResources' after 1.17 ms
[15:21:46] Starting subtask 'configure-webpack'...
[15:21:46] Finished subtask 'configure-webpack' after 1.15 ms
[15:21:46] Starting subtask 'webpack'...
[15:22:49] Finished subtask 'webpack' after 1.03 min
[15:22:49] Starting subtask 'configure-webpack-external-bundling'...
[15:22:49] Finished subtask 'configure-webpack-external-bundling' after 222 ms
[15:22:49] Starting subtask 'copy-assets'...

<--- Last few GCs --->

[11816:00000191464683D0]   629760 ms: Mark-sweep 1009.4 (1672.0) -> 1009.4 (1671.0) MB, 217.7 / 0.0 ms  allocation failure GC in old space requested
[11816:00000191464683D0]   630004 ms: Mark-sweep 1009.4 (1671.0) -> 1009.4 (1639.5) MB, 243.7 / 0.0 ms  last resort GC in old space requested
[11816:00000191464683D0]   630212 ms: Mark-sweep 1009.4 (1639.5) -> 1009.4 (1639.5) MB, 207.9 / 0.0 ms  last resort GC in old space requested


<--- JS stacktrace --->

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

Security context: 0000019448425879 <JSObject>
    1: stringSlice(aka stringSlice) [buffer.js:~555] [pc=000000511DFE3C0C](this=000000ABBE1822D1 <undefined>,buf=0000007CD33D5AB9 <Uint8Array map = 000003C65C2C3A71>,encoding=0000019448435221 <String[4]: utf8>,start=0,end=3488682)
    2: toString [buffer.js:~609] [pc=000000511F3114C8](this=0000007CD33D5AB9 <Uint8Array map = 000003C65C2C3A71>,encoding=0000019448435221 <String[4]: utf8>,start=00...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node_module_register
 2: v8::internal::FatalProcessOutOfMemory
 3: v8::internal::FatalProcessOutOfMemory
 4: v8::internal::Factory::NewRawTwoByteString
 5: v8::internal::Factory::NewStringFromUtf8
 6: v8::String::NewFromUtf8
 7: v8::internal::wasm::AsmType::Extern
 8: std::vector<v8::CpuProfileDeoptFrame,std::allocator<v8::CpuProfileDeoptFrame> >::vector<v8::CpuProfileDeoptFrame,std::allocator<v8::CpuProfileDeoptFrame> >
 9: 000000511E32C466

Package.json

{
  "name": "project-folders",
  "version": "3.1.1",
  "private": true,
  "engines": {
    "node": ">=0.10.0"
  },
  "dependencies": {
    "@microsoft/sp-core-library": "1.8.0",
    "@microsoft/sp-http": "1.8.0",
    "@microsoft/sp-lodash-subset": "1.8.0",
    "@microsoft/sp-property-pane": "1.8.0",
    "@microsoft/sp-webpart-base": "1.8.0",
    "@pnp/common": "~1.2.7",
    "@pnp/logging": "~1.2.7",
    "@pnp/odata": "~1.2.7",
    "@pnp/sp": "~1.2.7",
    "@types/es6-collections": "^0.5.31",
    "@types/es6-promise": "0.0.33",
    "@types/microsoft-ajax": "^0.0.33",
    "@types/react": "16.4.2",
    "@types/react-dom": "16.0.5",
    "@types/sharepoint": "^2016.1.2",
    "@types/webpack-env": "1.13.1",
    "core-js": "^2.5.4",
    "office-ui-fabric-react": "^6.156.0",
    "react": "16.7.0",
    "react-dom": "16.7.0"
  },
  "resolutions": {
    "@types/react": "16.4.2"
  },
  "devDependencies": {
    "@microsoft/sp-build-web": "1.8.0",
    "@microsoft/sp-module-interfaces": "1.8.0",
    "@microsoft/sp-tslint-rules": "1.8.0",
    "@microsoft/sp-webpart-workbench": "1.8.0",
    "@microsoft/rush-stack-compiler-3.3": "0.1.7",
    "@types/chai": "3.4.34",
    "@types/mocha": "2.2.38",
    "ajv": "~5.2.2",
    "gulp": "~3.9.1",
    "webpack-bundle-analyzer": "^3.0.3"
  },
  "scripts": {
    "build": "gulp bundle",
    "clean": "gulp clean",
    "test": "gulp test"
  }
}

tslint.json

{
  "extends": "@microsoft/sp-tslint-rules/base-tslint.json",
  "rules": {
    "class-name": false,
    "export-name": false,
    "forin": false,
    "label-position": false,
    "member-access": true,
    "no-arg": false,
    "no-console": false,
    "no-construct": false,
    "no-duplicate-variable": true,
    "no-eval": false,
    "no-function-expression": true,
    "no-internal-module": true,
    "no-shadowed-variable": true,
    "no-switch-case-fall-through": true,
    "no-unnecessary-semicolons": true,
    "no-unused-expression": true,
    "no-use-before-declare": true,
    "no-with-statement": true,
    "semicolon": true,
    "trailing-comma": false,
    "typedef": false,
    "typedef-whitespace": false,
    "use-named-parameter": true,
    "variable-name": false,
    "whitespace": false
  }
}

tsconfig.json

{
  "extends": "./node_modules/@microsoft/rush-stack-compiler-3.3/includes/tsconfig-web.json", 
  "compilerOptions": {
    "target": "es5",
    "forceConsistentCasingInFileNames": true,
    "module": "esnext",
    "moduleResolution": "node",
    "jsx": "react",
    "declaration": true,
    "sourceMap": true,
    "experimentalDecorators": true,
    "skipLibCheck": true,
    "outDir": "lib",
    "strictNullChecks": false,
    "inlineSources": false,   
    "typeRoots": [
      "./node_modules/@types",
      "./node_modules/@microsoft"
    ],
    "types": [
      "webpack-env",
      "microsoft-ajax",
      "sharepoint"
    ],
    "lib": [
      "es6",
      "dom",
      "es5",
      "es2015.collection"
    ]
  },
  "include": [
    "src/**/*.ts"
  ],
  "exclude": [
    "node_modules",
    "lib"
  ]
}

Steps to Reproduce

  1. Modify any file in project, save file
  2. Auto build fires
  3. Every 3-4th time, gives the error

Project contains 1 React-based web part.

I understand this is a bit vague, apologies, but I don't have much idea what to try, or what kind of addition information you would really need to be able to comment on the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:toolingCategory: Development toolingstatus:fixedIssue was fixed in current or prior release.status:trackedCurrently tracked with Microsoft’s internal issue tracking system. DO NOT ADD/REMOVE (MSFT managed)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions