0

This process worked correctly around 4 months after I allocate more compute memory but now it again occurred recently. I provide the error and build spec snapshot below Please help me to solve this problem. Thank You.

Log Tail

<--- Last few GCs --->

[194:0x602a710]   157171 ms: Scavenge 2012.6 (2071.4) -> 2012.2 (2081.9) MB, 4.6 / 0.0 ms  (average mu = 0.520, current mu = 0.203) allocation failure 
[194:0x602a710]   157184 ms: Scavenge 2020.1 (2082.4) -> 2019.8 (2083.4) MB, 4.5 / 0.0 ms  (average mu = 0.520, current mu = 0.203) allocation failure 
[194:0x602a710]   157767 ms: Scavenge 2021.0 (2083.4) -> 2020.2 (2105.4) MB, 582.3 / 0.0 ms  (average mu = 0.520, current mu = 0.203) allocation failure 


<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0xb09c10 node::Abort() [/usr/local/bin/node]
 2: 0xa1c193 node::FatalError(char const*, char const*) [/usr/local/bin/node]
 3: 0xcf8dde v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
 4: 0xcf9157 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
 5: 0xeb09f5  [/usr/local/bin/node]
 6: 0xec06bd v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
 7: 0xec33be v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
 8: 0xe848fa v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/local/bin/node]
 9: 0x11fd646 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
10: 0x15f20b9  [/usr/local/bin/node]

[Container] 2023/01/19 04:07:01 Command did not exit successfully npm run build exit status 1
[Container] 2023/01/19 04:07:01 Phase complete: BUILD State: FAILED
[Container] 2023/01/19 04:07:01 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: npm run build. Reason: exit status 1
[Container] 2023/01/19 04:07:01 Entering phase POST_BUILD
[Container] 2023/01/19 04:07:01 Phase complete: POST_BUILD State: SUCCEEDED
[Container] 2023/01/19 04:07:01 Phase context status code:  Message: 
[Container] 2023/01/19 04:07:02 exiting execCommands
[Container] 2023/01/19 04:07:02 Expanding base directory path: build
[Container] 2023/01/19 04:07:02 Assembling file list
[Container] 2023/01/19 04:07:02 Expanding build
[Container] 2023/01/19 04:07:02 Expanding file paths for base directory build
[Container] 2023/01/19 04:07:02 Assembling file list
[Container] 2023/01/19 04:07:02 Expanding **/*
[Container] 2023/01/19 04:07:02 Found 7 file(s)
[Container] 2023/01/19 04:07:02 Phase complete: UPLOAD_ARTIFACTS State: SUCCEEDED
[Container] 2023/01/19 04:07:02 Phase context status code:  Message: 

BuildSpec

version: 0.2

phases:
  install:
    runtime-versions:
      nodejs: 16
   
    commands:
        # install npm
        - npm install --force
       
  build:
    commands:
        # run build script
        - npm run build
     
artifacts:
    files:
        - '**/*'
    base-directory: build

Compute Memory-> 8GB 4 vCPUs

  • 2
    This question has some answers that may help you - https://stackoverflow.com/questions/65277508/aws-code-pipeline-error-fatal-error-ineffective-mark-compacts-near-heap-limit-a – Ankush Jain Jan 19 '23 at 06:24

1 Answers1

0

You can increase the amount of memory allocated to the build container. You can do this by modifying the memory settings in your build configuration file (e.g. buildspec.yml). You could use an EC2 instance with more memory to build a environment that is optimized for building React.js apps.

If your error is caused by webpack try to use the DllPlugin and DllReferencePlugin to split the code into smaller chunks.

Nehad Awad
  • 39
  • 3