postgrest-docs icon indicating copy to clipboard operation
postgrest-docs copied to clipboard

Purported memory leak on alpine linux - still valid in 2021?

Open LAC-Tech opened this issue 3 years ago • 6 comments

https://postgrest.org/en/stable/development.html?highlight=alpine#build-from-source

Do we know if this is still an issue? Is it referenced anywhere in another issue tracker?

I'd be happy to try building it myself on alpine and run any tests you'd like.

LAC-Tech avatar Apr 28 '21 01:04 LAC-Tech

I'd be happy to try building it myself on alpine and run any tests you'd like.

@LAC-Tech That'd be great!

It's been a while since we tested on alpine(check https://github.com/PostgREST/postgrest/issues/867). If you don't detect any issue after some load testing, we'll be happy to remove that warning.

steve-chavez avatar Apr 28 '21 02:04 steve-chavez

If this is about creating a small docker image in the end - note that our current nightly releases are all built as a single executable docker image. The next stable release will also be build like this. Chances are low that any alpine build could be smaller.

In any case, it'd be good to know!

wolfgangwalther avatar Apr 28 '21 06:04 wolfgangwalther

I'm just an alpine user, not really looking to make a docker image. To me though it's generally a good sign if a build works on edge cases like OpenBSD, musl systems, etc.

Unfortunately I'm having real difficulty with "stack" which the docs recommend to build postgrest from source.

LAPTOP-162NUQO7:~/postgrest$ stack build --install-ghc --copy-bins --local-bin-path /usr/local/bin
No setup information found for ghc-8.8.4 on your platform.
This probably means a GHC bindist has not yet been added for OS key 'linux64-ncurses6'.
Supported versions: ghc-7.10.3, ghc-8.0.1, ghc-8.0.2, ghc-8.2.1, ghc-8.2.2

So then I tried:

LAPTOP-162NUQO7:~/postgrest$ stack --compiler ghc-8.2.2 setup
Preparing to install GHC (ncurses6) to an isolated location.
This will not interfere with any system-level installation.
Downloaded ghc-ncurses6-8.2.2.
utils/ghc-cabal/dist-install/build/tmp/ghc-cabal-bindist: exec: line 3: utils/ghc-cabal/dist-install/build/tmp/ghc-cabal: not found
make[1]: *** [ghc.mk:991: install_packages] Error 127
make: *** [Makefile:51: install] Error 2
Received ExitFailure 2 when running
Raw command: /usr/bin/make install
Run from: /home/lewis/.stack/programs/x86_64-linux/ghc-ncurses6-8.2.2.temp/ghc-8.2.2/


Error: Error encountered while installing GHC with
         make install
         run in /home/lewis/.stack/programs/x86_64-linux/ghc-ncurses6-8.2.2.temp/ghc-8.2.2/

       The following directories may now contain files, but won't be used by stack:
         - /home/lewis/.stack/programs/x86_64-linux/ghc-ncurses6-8.2.2.temp/
         - /home/lewis/.stack/programs/x86_64-linux/ghc-ncurses6-8.2.2/

       For more information consider rerunning with --verbose flag

Installing GHC ...
LAPTOP-162NUQO7:~/postgrest$ make
make: *** No targets specified and no makefile found.  Stop.

With verbose mode I eventually get this

2021-04-29 10:12:38.925949: [error] utils/ghc-cabal/dist-install/build/tmp/ghc-cabal-bindist: exec: line 3: utils/ghc-cabal/dist-install/build/tmp/ghc-cabal: not found
2021-04-29 10:12:38.926389: [error] make[1]: *** [ghc.mk:991: install_packages] Error 127
2021-04-29 10:12:38.927826: [error] make: *** [Makefile:51: install] Error 2
2021-04-29 10:12:38.928280: [error] Received ExitFailure 2 when running
Raw command: /usr/bin/make install
Run from: /home/lewis/.stack/programs/x86_64-linux/ghc-ncurses6-8.2.2.temp/ghc-8.2.2/

2021-04-29 10:12:38.928571: [error]
Error: Error encountered while installing GHC with
         make install
         run in /home/lewis/.stack/programs/x86_64-linux/ghc-ncurses6-8.2.2.temp/ghc-8.2.2/

       The following directories may now contain files, but won't be used by stack:
         - /home/lewis/.stack/programs/x86_64-linux/ghc-ncurses6-8.2.2.temp/
         - /home/lewis/.stack/programs/x86_64-linux/ghc-ncurses6-8.2.2/

       For more information consider rerunning with --verbose flag

Installing GHC ...

Any tips would be appreciated - I feel like Stack is assuming some libraries I don't have, but I find it hard to grok.

LAC-Tech avatar Apr 28 '21 22:04 LAC-Tech

utils/ghc-cabal/dist-install/build/tmp/ghc-cabal: not found

Hm, seems it's looking for cabal.

Could you try building with plain cabal? Here's how I do it for ubuntu on ARM: https://github.com/steve-chavez/postgrest/blob/travis-arm/.travis.yml#L82-L108

steve-chavez avatar Apr 28 '21 22:04 steve-chavez

Both https://postgrest.org/en/stable/install.html#building-from-source and https://github.com/PostgREST/postgrest/issues/867 don't provide proper evidence of a memory leak. Did you file a GHC ticket? Which GHC version? So far to me this seems anecdotal and no one can really figure out the cause.

hasufell avatar Feb 25 '22 14:02 hasufell

So far to me this seems anecdotal and no one can really figure out the cause.

True, I've never reproduced that either.

How about if we just remove the Alpine warning?(still showing here https://postgrest.org/en/stable/install.html?highlight=%22Alpine%22#building-from-source)

(The need for a minimal image is already solved by Nix as mentioned above, but I don't see why we should discourage Alpine if users want it)

steve-chavez avatar Feb 25 '22 18:02 steve-chavez