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

Balena build breaks for certain directory structures #2660

Open
atlantis opened this issue Aug 2, 2023 · 0 comments
Open

Balena build breaks for certain directory structures #2660

atlantis opened this issue Aug 2, 2023 · 0 comments

Comments

@atlantis
Copy link

atlantis commented Aug 2, 2023

Expected Behavior

balena build should work with all directory structures/files

Actual Behavior

Javascript runs out of memory when certain dirs/files are included, but work fine if I zip them and unzip/process them inside the container. It seems like the node app gets stuck in an infinite loop with symlinks and then runs out of memory maybe?

[balena build -d imx8mm-var-dart -A aarch64                                                                       
[Build]   Building services...
[Build]   app Preparing...
[Info]    Building for aarch64/imx8mm-var-dart
[Info]    Docker Desktop detected (daemon architecture: "aarch64")
[Info]      Docker itself will determine and enable architecture emulation if required,
[Info]      without balena-cli intervention and regardless of the --emulated option.

<--- Last few GCs --->

[39574:0x7f8f18008000]    23863 ms: Scavenge 4043.5 (4122.6) -> 4040.6 (4123.9) MB, 3.7 / 0.0 ms  (average mu = 0.437, current mu = 0.349) task 
[39574:0x7f8f18008000]    23874 ms: Scavenge 4044.6 (4123.9) -> 4042.5 (4126.9) MB, 4.4 / 0.0 ms  (average mu = 0.437, current mu = 0.349) task 
[39574:0x7f8f18008000]    25325 ms: Scavenge 4046.6 (4126.9) -> 4044.4 (4144.1) MB, 1446.7 / 0.0 ms  (average mu = 0.437, current mu = 0.349) task 


<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0x10429cfb5 node::Abort() (.cold.1) [/usr/local/lib/balena-cli/bin/node]
 2: 0x102f961c9 node::Abort() [/usr/local/lib/balena-cli/bin/node]
 3: 0x102f963ae node::OOMErrorHandler(char const*, bool) [/usr/local/lib/balena-cli/bin/node]
 4: 0x10310b1f0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/lib/balena-cli/bin/node]
 5: 0x10310b1b3 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/lib/balena-cli/bin/node]
 6: 0x1032ac905 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/lib/balena-cli/bin/node]
 7: 0x1032ab28c v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/lib/balena-cli/bin/node]
 8: 0x10333a0bd v8::internal::ScavengeJob::Task::RunInternal() [/usr/local/lib/balena-cli/bin/node]
 9: 0x103001161 node::PerIsolatePlatformData::RunForegroundTask(std::__1::unique_ptr<v8::Task, std::__1::default_delete<v8::Task> >) [/usr/local/lib/balena-cli/bin/node]
10: 0x102fffbd7 node::PerIsolatePlatformData::FlushForegroundTasksInternal() [/usr/local/lib/balena-cli/bin/node]
11: 0x103958c9b uv__async_io [/usr/local/lib/balena-cli/bin/node]
12: 0x10396ca6b uv__io_poll [/usr/local/lib/balena-cli/bin/node]
13: 0x103959221 uv_run [/usr/local/lib/balena-cli/bin/node]
14: 0x102ec6733 node::SpinEventLoop(node::Environment*) [/usr/local/lib/balena-cli/bin/node]
15: 0x102fd7d11 node::NodeMainInstance::Run(int*, node::Environment*) [/usr/local/lib/balena-cli/bin/node]
16: 0x102fd7993 node::NodeMainInstance::Run() [/usr/local/lib/balena-cli/bin/node]
17: 0x102f5ff72 node::Start(int, char**) [/usr/local/lib/balena-cli/bin/node]
18: 0x207f5e310 
/usr/local/bin/balena: line 45: 39574 Abort trap: 6           "$NODE" "$DIR/run" "$@"

Steps to Reproduce the Problem

  1. Unzip the attached test_balena_oom.zip
  2. run balena build -d imx8mm-var-dart -A aarch64
  3. Watch javascript run out of memory

Specifications

  • balena-cli version "16.7.0"
  • Node.js version "16.20.1"
  • Mac M2 64 bit

Thanks for investigating! I do have a workaround for now (zip the lib dir to get it inside the container successfully, then unzip and use it there) but it seems like the balena cli should handle odd symlinks/lots of files/whatever the problem is with this particular directory structure!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant