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

docker build fails because of a memory issue #16

Closed
nobishino opened this issue Sep 15, 2021 · 1 comment · Fixed by #17
Closed

docker build fails because of a memory issue #16

nobishino opened this issue Sep 15, 2021 · 1 comment · Fixed by #17

Comments

@nobishino
Copy link
Contributor

nobishino commented Sep 15, 2021

docker build . fails and outputs the following logs:

> [4/4] RUN make build:                                                                                                                            
#9 0.220 Installing NPM dependencies...                                                                                                             
#9 5.815                                                                                                                                            
#9 5.815 > ejs@3.1.3 postinstall /code/node_modules/ejs                                                                                             
#9 5.815 > node --harmony ./postinstall.js                                                                                                          
#9 5.815 
#9 5.880 Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)
#9 5.880 
#9 5.938 added 205 packages in 5.074s
#9 5.958 Compiling TypeScript...
#9 28.04 
#9 28.04 <--- Last few GCs --->
#9 28.04 
#9 28.04 [29:0x5d5c160]    21532 ms: Mark-sweep (reduce) 989.7 (994.4) -> 988.9 (995.4) MB, 540.9 / 0.0 ms  (average mu = 0.102, current mu = 0.032) allocation failure scavenge might not succeed
#9 28.04 
#9 28.04 
#9 28.04 <--- JS stacktrace --->
#9 28.04 
#9 28.04 FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
#9 28.05  1: 0xa04200 node::Abort() [node]
#9 28.05  2: 0x94e4e9 node::FatalError(char const*, char const*) [node]
#9 28.05  3: 0xb7978e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
#9 28.05  4: 0xb79b07 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
#9 28.05  5: 0xd34395  [node]
#9 28.05  6: 0xd34f1f  [node]
#9 28.05  7: 0xd42fab v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
#9 28.05  8: 0xd46b6c v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
#9 28.06  9: 0xd1524b v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
#9 28.06 10: 0x105b23f v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
#9 28.06 11: 0x1401219  [node]
#9 28.33 Makefile:34: recipe for target '_ts' failed
#9 28.33 make: *** [_ts] Aborted
------
executor failed running [/bin/sh -c make build]: exit code: 2

Reprodusible steps

  • git clone
  • cd metasearch
  • docker build .

I expect the build to succeed, but it fails.

Environment

  • Mac OS Big Sur(11.2.3)
  • Architecture: amd64

output of docker version:

docker version
Client:
 Cloud integration: 1.0.17
 Version:           20.10.8
 API version:       1.41
 Go version:        go1.16.6
 Git commit:        3967b7d
 Built:             Fri Jul 30 19:55:20 2021
 OS/Arch:           darwin/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.8
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.6
  Git commit:       75249d8
  Built:            Fri Jul 30 19:52:10 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.9
  GitCommit:        e25210fe30a0a703442421b0f60afac609f950a3
 runc:
  Version:          1.0.1
  GitCommit:        v1.0.1-0-g4144b63
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

A possible way to avoid the issue

I could avoid this issue by adding NODE_OPTIONS=--max_old_space_size=4096 environment variable to the Makefile (or Dockerfile) like this commit.

I wonder if this is the right way to go. (If so, I'd like to create a PR.)

@artnc
Copy link
Member

artnc commented Sep 15, 2021

Sure, a PR would be appreciated!

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

Successfully merging a pull request may close this issue.

2 participants