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

FATAL ERROR: invalid array length Allocation failed - JavaScript heap out of memory #8517

Closed
4 tasks done
jamescrowley opened this issue Oct 21, 2021 · 8 comments · Fixed by #8540
Closed
4 tasks done
Assignees
Labels
bug Something isn't working pending-release Code has been merged but pending release platform Issues tied to the general CLI platform

Comments

@jamescrowley
Copy link

Before opening, please confirm:

  • I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
  • I have searched for duplicate or closed issues.
  • I have read the guide for submitting bug reports.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

How did you install the Amplify CLI?

No response

If applicable, what version of Node.js are you using?

No response

Amplify CLI Version

6.3.1

What operating system are you using?

macOS

Amplify Categories

function

Amplify Commands

update

Describe the bug

I get an exception when running amplify function update (before being offered any options). I'm not sure if it's related to my recently updating to 6.3.1 as I haven't run amplify function update in a while, but it definitely worked previously

Expected behavior

amplify function update should always work or display a helpful error message

Reproduction steps

Run amplify function update. Not yet clear what it is about the state which is triggering this?


<--- Last few GCs --->

[3377:0x102d94000]    14550 ms: Scavenge 1256.1 (1291.4) -> 1256.1 (1291.4) MB, 177.5 / 0.0 ms  (average mu = 0.990, current mu = 0.990) allocation failure 
[3377:0x102d94000]    20929 ms: Mark-sweep 1829.9 (1865.2) -> 1795.5 (1842.3) MB, 459.3 / 0.1 ms  (+ 3.0 ms in 9 steps since start of marking, biggest step 1.1 ms, walltime since start of marking 13101 ms) (average mu = 0.975, current mu = 0.971) allocati

<--- JS stacktrace --->

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

    0: ExitFrame [pc: 0x1009d5fd9]
Security context: 0x259fb2c008d1 <JSObject>
    1: getResourcesToBeCreated(aka getResourcesToBeCreated) [0x259f10a1f879] [/Users/jcrowley/.nvm/versions/node/v12.17.0/lib/node_modules/@aws-amplify/cli/lib/extensions/amplify-helpers/resource-status-data.js:~156] [pc=0x2f9445a22f0b](this=0x259ff2c404b1 <undefined>,0x259f4e0b4a19 <Object map = 0x259ff9063529>,0x259fc5715d79 <Object map = 0x259ff9063529>,0x25...

FATAL ERROR: invalid array length Allocation failed - JavaScript heap out of memory
 1: 0x1011c9b35 node::Abort() (.cold.1) [/Users/jcrowley/.nvm/versions/node/v12.17.0/bin/node]
 2: 0x10009ca99 node::Abort() [/Users/jcrowley/.nvm/versions/node/v12.17.0/bin/node]
 3: 0x10009cbff node::OnFatalError(char const*, char const*) [/Users/jcrowley/.nvm/versions/node/v12.17.0/bin/node]
 4: 0x1001ddb37 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/Users/jcrowley/.nvm/versions/node/v12.17.0/bin/node]
 5: 0x1001ddad7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/jcrowley/.nvm/versions/node/v12.17.0/bin/node]
 6: 0x1003659d5 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/Users/jcrowley/.nvm/versions/node/v12.17.0/bin/node]
 7: 0x10033a04a v8::internal::Factory::NewFixedArrayWithFiller(v8::internal::RootIndex, int, v8::internal::Object, v8::internal::AllocationType) [/Users/jcrowley/.nvm/versions/node/v12.17.0/bin/node]
 8: 0x1004b5594 v8::internal::(anonymous namespace)::ElementsAccessorBase<v8::internal::(anonymous namespace)::FastPackedObjectElementsAccessor, v8::internal::(anonymous namespace)::ElementsKindTraits<(v8::internal::ElementsKind)2> >::GrowCapacity(v8::internal::Handle<v8::internal::JSObject>, unsigned int) [/Users/jcrowley/.nvm/versions/node/v12.17.0/bin/node]
 9: 0x100666464 v8::internal::Runtime_GrowArrayElements(int, unsigned long*, v8::internal::Isolate*) [/Users/jcrowley/.nvm/versions/node/v12.17.0/bin/node]
10: 0x1009d5fd9 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/Users/jcrowley/.nvm/versions/node/v12.17.0/bin/node]
Abort trap: 6

GraphQL schema(s)

# Put schemas below this line

Log output

# Put your logs below this line


Additional information

No response

@cjihrig
Copy link
Contributor

cjihrig commented Oct 22, 2021

@jamescrowley I'm sorry you're having this issue. I have a few questions:

  • Does using a more recent version of Node.js make any difference?
  • Does this issue reproduce 100% of the time? If it does reproduce 100% of the time, would you mind zipping up your project and sending it to us at amplify-cli@amazon.com, so we can try to fix the issue for you.
  • Does this issue reproduce on any previous versions of the CLI, such as v6.3.0? If it does not reproduce on other versions, you can downgrade until the issue is resolved.

@jamescrowley
Copy link
Author

jamescrowley commented Oct 25, 2021

@cjihrig thanks. In response to your points

  1. I was currently using node v12.17, just tried v17.0.1 but still fails, with a different message, pasted below
  2. Yes, it reproduces 100% of the time. I've sent an email with the source code
  3. I'll try this

Node 17 error:


#
# Fatal error in , line 0
# Fatal JavaScript invalid size error 169220804
#
#
#
#FailureMessage Object: 0x7ffee5d2db80
 1: 0x10a006a32 node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/Users/jcrowley/.nvm/versions/node/v17.0.1/bin/node]
 2: 0x10b0aead3 V8_Fatal(char const*, ...) [/Users/jcrowley/.nvm/versions/node/v17.0.1/bin/node]
 3: 0x10a288cc6 v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArray(int, v8::internal::AllocationType) [/Users/jcrowley/.nvm/versions/node/v17.0.1/bin/node]
 4: 0x10a41d764 v8::internal::(anonymous namespace)::ElementsAccessorBase<v8::internal::(anonymous namespace)::FastPackedObjectElementsAccessor, v8::internal::(anonymous namespace)::ElementsKindTraits<(v8::internal::ElementsKind)2> >::GrowCapacity(v8::internal::Handle<v8::internal::JSObject>, unsigned int) [/Users/jcrowley/.nvm/versions/node/v17.0.1/bin/node]
 5: 0x10a6439bd v8::internal::Runtime_GrowArrayElements(int, unsigned long*, v8::internal::Isolate*) [/Users/jcrowley/.nvm/versions/node/v17.0.1/bin/node]
 6: 0x10a9ff439 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/Users/jcrowley/.nvm/versions/node/v17.0.1/bin/node]
Trace/BPT trap: 5

@jamescrowley
Copy link
Author

jamescrowley commented Oct 25, 2021

@cjihrig I've noticed I also now get

Could not initialize 'prod': EEXIST: file already exists, symlink '../uuid/dist/bin/uuid' -> '/XX/XX/XX/XX-app/XXBackend/amplify/.temp/#current-cloud-backend/function/s3client/lib/nodejs/node_modules/.bin/uuid'

when trying to checkout an environment, even having done a git clean -FX (deleting amplify/* plus awsconfiguration.json/amplifyconfiguration.json) and run amplify init again - on both versions of node

@cjihrig
Copy link
Contributor

cjihrig commented Oct 25, 2021

@jamescrowley I think I've identified the source of the OOM error. There is a bug on our side that was growing an array until the process crashed. See #8540.

@jamescrowley
Copy link
Author

thanks @cjihrig ... apologies - I actually thought I'd succeeded in removing any dependency cycles but it would seem not!

@cjihrig cjihrig self-assigned this Oct 26, 2021
@jamescrowley
Copy link
Author

@cjihrig any idea when the next release will be out that includes this? Many thanks

@cjihrig
Copy link
Contributor

cjihrig commented Nov 1, 2021

@jamescrowley I can't commit to anything certain, but hopefully within the next week or so.

@josefaidt josefaidt added bug Something isn't working pending-release Code has been merged but pending release platform Issues tied to the general CLI platform labels Nov 1, 2021
@github-actions
Copy link

github-actions bot commented Jan 1, 2022

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working pending-release Code has been merged but pending release platform Issues tied to the general CLI platform
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants