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

Dockerfile Build issue #203

Closed
Tarektouati opened this issue Jun 5, 2018 · 2 comments
Closed

Dockerfile Build issue #203

Tarektouati opened this issue Jun 5, 2018 · 2 comments

Comments

@Tarektouati
Copy link

Tarektouati commented Jun 5, 2018

Hello,
i can't build the Dockerfile on : RUN stack build => The command '/bin/sh -c stack build' returned a non-zero code: 137

      /root/.stack/setup-exe-cache/x86_64-linux-nopie/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-linux-nopie/Cabal-1.24.2.0 build --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure (-9) (THIS MAY INDICATE OUT OF MEMORY)
    Logs have been written to: /duckling/.stack-work/logs/haskell-src-exts-1.18.2.log

    Configuring haskell-src-exts-1.18.2...
    Building haskell-src-exts-1.18.2...
    Preprocessing library haskell-src-exts-1.18.2...
    [ 1 of 17] Compiling Language.Haskell.Exts.Syntax ( src/Language/Haskell/Exts/Syntax.hs, .stack-work/dist/x86_64-linux-nopie/Cabal-1.24.2.0/build/Language/Haskell/Exts/Syntax.o )```
@panagosg7
Copy link
Contributor

panagosg7 commented Jun 7, 2018

Hi @Tarektouati,

Can you try to follow the instruction in the Dockerfile (ie. run with -j1)?

# NOTE:`stack build` will use as many cores as are available to build
# in parallel. However, this can cause OOM issues as the linking step
# in GHC can be expensive. If the build fails, try specifying the
# '-j1' flag to force the build to run sequentially.

It looks like it should help with out-of-memory issues.

@Tarektouati
Copy link
Author

Thanks it worked for me

lfborjas added a commit to lfborjas/freenatalchart.xyz that referenced this issue Oct 18, 2020
It seems that certain haskell packages (in my case, haskell-src-exts,)
take up so much memory that docker dies trying to run them, so we make
it run with one job, vs. as many as possible in parallel.

See:

* https://github.com/facebook/duckling/blob/7889f396f324028075d39e5003f1083ad05d68f3/Dockerfile
* facebook/duckling#203
* wireapp/wire-server#562
* https://stackoverflow.com/questions/56496852/problem-building-a-docker-container-with-haskell-stack-how-can-i-ensure-that-ha
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

2 participants