Giter VIP home page Giter VIP logo

Comments (16)

 avatar commented on August 31, 2024 6

I've tested around and got it working with alpine.

You need to make sure that libgcc and libstdc++ are present in the final image. If these arent present, the erlang vm will crash with the mentioned error.

from prometheus_process_collector.

deadtrickster avatar deadtrickster commented on August 31, 2024 2

Having this working on various linuxes,MacOS and FreeBSDs feel helpless a bit now.
One thing I could suggest - go to c_src on build machine run make memory-test.
Grab the binary and try to run it on the deployment machine. Maybe will get more naked errors.

from prometheus_process_collector.

4xposed avatar 4xposed commented on August 31, 2024 2

funny enough changing my dependencies to:

{:prometheus, "~> 4.0", override: true},
{:prometheus_process_collector, "~> 1.3.1"}

fixed the issue on the one server where the release would crash

from prometheus_process_collector.

Ebtoulson avatar Ebtoulson commented on August 31, 2024 2

Not sure if this is going to help anyone but this is the results of the memory test.

Dockerfile used:

FROM elixir:1.8.2-alpine AS base

ENV DOCKER_APP_ROOT=/prometheus_process_collector MIX_ENV=prod

WORKDIR $DOCKER_APP_ROOT

RUN apk add --no-cache \
  ca-certificates \
  g++ \
  gcc \
  git \
  jq \
  make \
  musl-dev \
  valgrind

COPY . $DOCKER_APP_ROOT/

ENTRYPOINT ["/prometheus_process_collector/bin/checks.sh"]

Output of docker run

Loading files...
Loading src/prometheus_process_collector.erl
Applying rules...
# src/prometheus_process_collector.erl [OK]
Loading files...
Applying rules...
Loading files...
Loading rebar.config
Applying rules...
# rebar.config [OK]
Loading files...
Loading elvis.config
Applying rules...
# elvis.config [OK]
===> Package rebar3_archive_plugin-0.0.2 not found. Fetching registry updates and trying again...
===> Updating package registry...
===> Writing registry to /root/.cache/rebar3/hex/default/registry
===> Generating package index...
===> [appsignal:1.6.2], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.6.6-beta.1], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.6.0], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.7.0-alpha.4], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.6.0-beta.1], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.6.3], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.7.0-alpha.3], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [prometheus_httpd:2.1.10], Bad dependency version for prometheus: ~> 3.5 or ~> 4.2.
===> [appsignal:1.7.0-alpha.2], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.7.0-alpha.1], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.6.1], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.6.5], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.6.6-beta.2], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.6.6], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.6.7], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.6.4], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.6.0-alpha.1], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> Writing index to /root/.cache/rebar3/hex/default/packages.idx
===> Fetching rebar3_archive_plugin ({pkg,<<"rebar3_archive_plugin">>,
                                      <<"0.0.2">>})
===> Downloaded package, caching at /root/.cache/rebar3/hex/default/packages/rebar3_archive_plugin-0.0.2.tar
===> Fetching rebar3_elvis_plugin ({git,
                                       "https://github.com/deadtrickster/rebar3_elvis_plugin.git",
                                       "master"})
===> WARNING: It is recommended to use {branch, Name}, {tag, Tag} or {ref, Ref}, otherwise updating the dep may not work as expected.
===> Fetching katana_code ({pkg,<<"katana_code">>,<<"0.1.0">>})
===> Downloaded package, caching at /root/.cache/rebar3/hex/default/packages/katana_code-0.1.0.tar
===> Fetching zipper ({pkg,<<"zipper">>,<<"1.0.1">>})
===> Downloaded package, caching at /root/.cache/rebar3/hex/default/packages/zipper-1.0.1.tar
===> Fetching aleppo ({pkg,<<"inaka_aleppo">>,<<"1.0.0">>})
===> Downloaded package, caching at /root/.cache/rebar3/hex/default/packages/inaka_aleppo-1.0.0.tar
===> Compiling aleppo
_build/default/plugins/aleppo/src/aleppo.erl:6: Warning: record ale_context has field(s) without type information
_build/default/plugins/aleppo/src/aleppo.erl:12: Warning: missing specification for function process_file/1
_build/default/plugins/aleppo/src/aleppo.erl:15: Warning: missing specification for function process_file/2
_build/default/plugins/aleppo/src/aleppo.erl:25: Warning: missing specification for function process_tokens/1
_build/default/plugins/aleppo/src/aleppo.erl:32: Warning: missing specification for function process_tokens/2
_build/default/plugins/aleppo/src/aleppo.erl:307: Warning: missing specification for function scan_file/1

===> Compiling zipper
===> Compiling katana_code
===> Compiling rebar3_elvis_plugin
===> Compiling rebar3_archive_plugin
===> Linking _build/default/plugins/rebar3_archive_plugin to _build/test/plugins/rebar3_archive_plugin
===> Linking _build/default/plugins/rebar3_elvis_plugin to _build/test/plugins/rebar3_elvis_plugin
===> Linking _build/default/plugins/katana_code to _build/test/plugins/katana_code
===> Linking _build/default/plugins/zipper to _build/test/plugins/zipper
===> Linking _build/default/plugins/aleppo to _build/test/plugins/aleppo
===> Verifying dependencies...
===> Fetching prometheus ({pkg,<<"prometheus">>,<<"4.2.2">>})
===> Downloaded package, caching at /root/.cache/rebar3/hex/default/packages/prometheus-4.2.2.tar
===> Linking _build/default/lib/prometheus to _build/test/lib/prometheus
===> Compiling prometheus
===> Compiling prometheus_process_collector
make: Entering directory '/prometheus_process_collector/c_src'
g++ -O3 -finline-functions -fPIC -I /usr/local/lib/erlang/erts-10.3.5.1/include/ -I /usr/local/lib/erlang/lib/erl_interface-3.11.3/include -std=c++11 -Wall  -c -o prometheus_process_collector_nif.o prometheus_process_collector_nif.cc
g++ -O3 -finline-functions -fPIC -I /usr/local/lib/erlang/erts-10.3.5.1/include/ -I /usr/local/lib/erlang/lib/erl_interface-3.11.3/include -std=c++11 -Wall  -c -o prometheus_process_info_linux.o prometheus_process_info_linux.cc
cc prometheus_process_collector_nif.o prometheus_process_info_linux.o -shared -L /usr/local/lib/erlang/lib/erl_interface-3.11.3/lib -lerl_interface -lei -lstdc++ -o /prometheus_process_collector/c_src/../priv/prometheus_process_collector.so
make: Leaving directory '/prometheus_process_collector/c_src'
===> Performing EUnit tests...
.................

Top 10 slowest tests (0.000 seconds, 0.0% of total time):
  prometheus_process_collector_tests:test_process_collector/1:15
    0.000 seconds
  prometheus_process_collector_tests:test_process_collector/1:23
    0.000 seconds
  prometheus_process_collector_tests:test_process_collector/1:19
    0.000 seconds
  prometheus_process_collector_tests:test_process_collector/1:27
    0.000 seconds
  prometheus_process_collector_tests:test_process_collector/1:25
    0.000 seconds
  prometheus_process_collector_tests:test_process_collector/1:24
    0.000 seconds
  prometheus_process_collector_tests:test_process_collector/1:21
    0.000 seconds
  prometheus_process_collector_tests:test_process_collector/1:17
    0.000 seconds
  prometheus_process_collector_tests:test_process_collector/1:29
    0.000 seconds
  prometheus_process_collector_tests:test_process_collector/1:20
    0.000 seconds

Finished in 1.801 seconds
17 tests, 0 failures
g++ -D__STANDALONE_TEST__ -std=c++11 -Wall -L /usr/local/lib/erlang/lib/erl_interface-3.11.3/lib -lerl_interface -lei -lstdc++ prometheus_process_info_mt.cc prometheus_process_info_linux.cc -o /prometheus_process_collector/c_src/../_build/memory_test
valgrind --leak-check=full --error-exitcode=1 /prometheus_process_collector/c_src/../_build/memory_test 2
==329== Memcheck, a memory error detector
==329== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==329== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
==329== Command: /prometheus_process_collector/c_src/../_build/memory_test 2
==329==
1
1
==329==
==329== HEAP SUMMARY:
==329==     in use at exit: 73,859 bytes in 4 blocks
==329==   total heap usage: 46 allocs, 42 frees, 101,311 bytes allocated
==329==
==329== LEAK SUMMARY:
==329==    definitely lost: 0 bytes in 0 blocks
==329==    indirectly lost: 0 bytes in 0 blocks
==329==      possibly lost: 0 bytes in 0 blocks
==329==    still reachable: 73,859 bytes in 4 blocks
==329==         suppressed: 0 bytes in 0 blocks
==329== Reachable blocks (those to which a pointer was found) are not shown.
==329== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==329==
==329== For counts of detected and suppressed errors, rerun with: -v
==329== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

from prometheus_process_collector.

Stratus3D avatar Stratus3D commented on August 31, 2024 1

I realized the Dockerfile I was using ran the command mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2 after installing the musl-dev package. I'm not sure why that was needed for the project, seems like it might have been trying to fool something into thinking glibc was present. Either way it seems a bit hacky to me.

I removed that code and added the glibc alpine package and now everything works fine. Does anyone have any experience using glibc and musl together? As best I can tell everything is working fine now, but I'm not sure if there is a better way of doing this.

from prometheus_process_collector.

entone avatar entone commented on August 31, 2024

I also have this happening with the 1.4 release. I have several other apps on 1.3.1 which work fine. Very similar setup to what @michaelstalker is using.

App release is being built on Docker image elixir:1.6.5-alpine

from prometheus_process_collector.

deadtrickster avatar deadtrickster commented on August 31, 2024

Maybe it happens because I don't use alpine? can someone post me minimal docker file to reproduce

from prometheus_process_collector.

entone avatar entone commented on August 31, 2024

so here is the relevant part of my build.

# Dockerfile
FROM elixir:1.6.5-alpine as build

# install build dependencies
RUN apk add --update git build-base

# prepare build dir
RUN mkdir /app
WORKDIR /app

# install hex + rebar
RUN mix local.hex --force && \
    mix local.rebar --force

# set build ENV
ENV MIX_ENV=prod

# install mix dependencies
COPY . .

RUN mix do deps.get, deps.compile

# build release
RUN mix release --no-tar --verbose

from prometheus_process_collector.

jdewar avatar jdewar commented on August 31, 2024

also ran into this. i have a feeling that #9, #10, #14 and #13 might be related. we noticed a problem when metrics weren't being collected (#14), we had a startup problem and the errors looked like #9 and this, and finally the suggestion in #10 seemed to fix the startup issue.

from prometheus_process_collector.

4xposed avatar 4xposed commented on August 31, 2024

I am having the same issue using prometheus_process_collector 1.4.0
Elixir 1.7.4 with OTP 21.2

machine where I make the build:

$ uname -a
Linux ship 4.18.11-gentoo #1 SMP Sat Sep 29 19:11:49 -00 2018 x86_64 Intel(R) Xeon(R) CPU E5-1650 v2 @ 3.50GHz GenuineIntel GNU/Linux

machine where I run the build

 $ uname -a
Linux frontend-1 4.14.7-gentoo #1 SMP Tue May 15 19:11:09 -00 2018 x86_64 Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz GenuineIntel GNU/Linux

from prometheus_process_collector.

4xposed avatar 4xposed commented on August 31, 2024

seems to be issues with the machine running the release, the release ran without issues in other servers.

sorry for the trouble and thank you for your quick reply!

from prometheus_process_collector.

frepond avatar frepond commented on August 31, 2024

Hi, the same happens here. Not able to upgrade to 1.4.x running on docker with alpine linux. I works with 1.3.1 without problems though.

from prometheus_process_collector.

Stratus3D avatar Stratus3D commented on August 31, 2024

Used @Ebtoulson's Dockerfile and got the same output:

output
Loading files...
Loading src/prometheus_process_collector.erl
Applying rules...
# src/prometheus_process_collector.erl [OK]
Loading files...
Applying rules...
Loading files...
Loading rebar.config
Applying rules...
# rebar.config [OK]
Loading files...
Loading elvis.config
Applying rules...
# elvis.config [OK]
===> Package rebar3_archive_plugin-0.0.2 not found. Fetching registry updates and trying again...
===> Updating package registry...
===> Writing registry to /root/.cache/rebar3/hex/default/registry
===> Generating package index...
===> [appsignal:1.6.2], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.6.6-beta.1], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.6.0], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.7.0-alpha.4], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.6.0-beta.1], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.6.3], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.7.0-alpha.3], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [prometheus_httpd:2.1.10], Bad dependency version for prometheus: ~> 3.5 or ~> 4.2.
===> [appsignal:1.7.0-alpha.2], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.7.0-alpha.1], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.6.1], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.6.5], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.6.6-beta.2], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.6.6], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.6.7], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.6.4], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> [appsignal:1.6.0-alpha.1], Bad dependency version for httpoison: ~> 0.11 or ~> 1.0.
===> Writing index to /root/.cache/rebar3/hex/default/packages.idx
===> Verifying dependencies...
===> Compiling prometheus_process_collector
make: Entering directory '/prometheus_process_collector/c_src'
g++ -O3 -finline-functions -fPIC -I /usr/local/lib/erlang/erts-10.3.5.1/include/ -I /usr/local/lib/erlang/lib/erl_interface-3.11.3/include -std=c++11 -Wall  -c -o prometheus_process_collector_nif.o prometheus_process_collector_nif.cc
g++ -O3 -finline-functions -fPIC -I /usr/local/lib/erlang/erts-10.3.5.1/include/ -I /usr/local/lib/erlang/lib/erl_interface-3.11.3/include -std=c++11 -Wall  -c -o prometheus_process_info_linux.o prometheus_process_info_linux.cc
cc prometheus_process_collector_nif.o prometheus_process_info_linux.o -shared -L /usr/local/lib/erlang/lib/erl_interface-3.11.3/lib -lerl_interface -lei -lstdc++ -o /prometheus_process_collector/c_src/../priv/prometheus_process_collector.so
make: Leaving directory '/prometheus_process_collector/c_src'
===> Failed to restore /prometheus_process_collector/_build/test/lib/prometheus_process_collector/.rebar3/erlcinfo file. Discarding it.

===> Performing EUnit tests...
.................

Top 10 slowest tests (0.000 seconds, 0.0% of total time):
  prometheus_process_collector_tests:test_process_collector/1:15
    0.000 seconds
  prometheus_process_collector_tests:test_process_collector/1:23
    0.000 seconds
  prometheus_process_collector_tests:test_process_collector/1:19
    0.000 seconds
  prometheus_process_collector_tests:test_process_collector/1:27
    0.000 seconds
  prometheus_process_collector_tests:test_process_collector/1:25
    0.000 seconds
  prometheus_process_collector_tests:test_process_collector/1:24
    0.000 seconds
  prometheus_process_collector_tests:test_process_collector/1:21
    0.000 seconds
  prometheus_process_collector_tests:test_process_collector/1:17
    0.000 seconds
  prometheus_process_collector_tests:test_process_collector/1:29
    0.000 seconds
  prometheus_process_collector_tests:test_process_collector/1:20
    0.000 seconds

Finished in 0.747 seconds
17 tests, 0 failures
g++ -D__STANDALONE_TEST__ -std=c++11 -Wall -L /usr/local/lib/erlang/lib/erl_interface-3.11.3/lib -lerl_interface -lei -lstdc++ prometheus_process_info_mt.cc prometheus_process_info_linux.cc -o /prometheus_process_collector/c_src/../_build/memory_test
valgrind --leak-check=full --error-exitcode=1 /prometheus_process_collector/c_src/../_build/memory_test 2
==272== Memcheck, a memory error detector
==272== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==272== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
==272== Command: /prometheus_process_collector/c_src/../_build/memory_test 2
==272== 
1
1
==272== 
==272== HEAP SUMMARY:
==272==     in use at exit: 73,859 bytes in 4 blocks
==272==   total heap usage: 46 allocs, 42 frees, 101,925 bytes allocated
==272== 
==272== LEAK SUMMARY:
==272==    definitely lost: 0 bytes in 0 blocks
==272==    indirectly lost: 0 bytes in 0 blocks
==272==      possibly lost: 0 bytes in 0 blocks
==272==    still reachable: 73,859 bytes in 4 blocks
==272==         suppressed: 0 bytes in 0 blocks
==272== Reachable blocks (those to which a pointer was found) are not shown.
==272== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==272== 
==272== For counts of detected and suppressed errors, rerun with: -v
==272== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

from prometheus_process_collector.

Stratus3D avatar Stratus3D commented on August 31, 2024

From the description of the elixir:<version>-alpine images:

This variant is highly recommended when final image size being as small as possible is desired. The main caveat to note is that it does use musl libc instead of glibc and friends, so certain software might run into issues depending on the depth of their libc requirements. However, most software doesn't have an issue with this, so this variant is usually a very safe choice.

Maybe this is the problem? It's odd that it compiles without an errors. I would think if there was an issue with musl libc I would at least see a warning.

from prometheus_process_collector.

 avatar commented on August 31, 2024

Are there any updates on this issue? The issue is still present with Elixir v1.10.3, OTP 22 [erts-10.7.2.1] and alpine:latest docker image. I'm not feeling fine adding glibc package when there's already musl present, unless there has been no issues so far (@Stratus3D).

from prometheus_process_collector.

Stratus3D avatar Stratus3D commented on August 31, 2024

@CharlotteDunois if I remember correctly I ended removing this package from my application as I wasn't actively using the metrics it provided.

from prometheus_process_collector.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.