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

Appmetrics fails to install in docker node:10.15.3-alpine image #582

Closed
meysholdt opened this issue May 31, 2019 · 9 comments
Closed

Appmetrics fails to install in docker node:10.15.3-alpine image #582

meysholdt opened this issue May 31, 2019 · 9 comments
Assignees
Labels

Comments

@meysholdt
Copy link

my Dockerfile:

FROM node:10.15.3-alpine

RUN apk add --no-cache --update \
    curl \
    python \
    build-base \
    libexecinfo-dev \
    libc6-compat

RUN yarn global add appmetrics@5.0.0

when I run docker build . I get the following log output:

Sending build context to Docker daemon  4.096kB
Step 1/3 : FROM node:10.15.3-alpine
 ---> 56bc3a1ed035
Step 2/3 : RUN apk add --no-cache --update     curl     python     build-base     libexecinfo-dev     libc6-compat
 ---> Using cache
 ---> 7a0b01d89c93
Step 3/3 : RUN yarn global add appmetrics@5.0.0
 ---> Running in b5696205c960
yarn global v1.13.0
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "appmetrics@5.0.0" is missing a bundled dependency "tar". This should be reported to the package maintainer.
[4/4] Building fresh packages...
error /usr/local/share/.config/yarn/global/node_modules/appmetrics: Command failed.
Exit code: 1
Command: node extract_all_binaries.js || node-gyp rebuild
Arguments: 
Directory: /usr/local/share/.config/yarn/global/node_modules/appmetrics
Output:
Fri, 31 May 2019 14:09:52 GMT
********************************************************************************
You are installing the Node Application Metrics monitoring and profiling module.
Licensed under the Apache License, Version 2.0 (the "License")
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
********************************************************************************
Unsupported version v10.15.3. Trying rebuild.
Falling back to node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@10.15.3 | linux | x64
gyp http GET https://nodejs.org/download/release/v10.15.3/node-v10.15.3-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v10.15.3/node-v10.15.3-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v10.15.3/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v10.15.3/SHASUMS256.txt
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/share/.config/yarn/global/node_modules/appmetrics/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/root/.node-gyp/10.15.3/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/root/.node-gyp/10.15.3',
gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/root/.node-gyp/10.15.3/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/usr/local/share/.config/yarn/global/node_modules/appmetrics',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/usr/local/share/.config/yarn/global/node_modules/appmetrics/build'
  ACTION binding_gyp_appmetrics_target_Set_appmetrics_reported_version_build_level Release/obj.target/appmetrics/geni/appmetrics.cpp
infile: ./src/appmetrics.cpp
outfile: /usr/local/share/.config/yarn/global/node_modules/appmetrics/build/Release/obj.target/appmetrics/geni/appmetrics.cpp
Replacing '"99\.99\.99\.29991231"' with '"5.0.0.201905311409"'
  CXX(target) Release/obj.target/appmetrics/geni/appmetrics.o
In file included from Release/obj.target/appmetrics/geni/appmetrics.cpp:22:
../../nan/nan.h: In function 'void Nan::AsyncQueueWorker(Nan::AsyncWorker*)':
../../nan/nan.h:2298:62: warning: cast between incompatible function types from 'void (*)(uv_work_t*)' {aka 'void (*)(uv_work_s*)'} to 'uv_after_work_cb' {aka 'void (*)(uv_work_s*, int)'} [-Wcast-function-type]
     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
                                                              ^
In file included from Release/obj.target/appmetrics/geni/appmetrics.cpp:25:
../src/plugins/node/prof/watchdog.h: In function 'const char* watchdog::StartCpuProfiling(v8::Isolate*, uint64_t)':
../src/plugins/node/prof/watchdog.h:251:6: error: 'struct sigevent' has no member named '_sigev_un'; did you mean 'sigevent'?
   ev._sigev_un._tid = profiler_tid;
      ^~~~~~~~~
      sigevent
../src/plugins/node/prof/watchdog.h:252:21: error: 'SIGEV_THREAD_ID' was not declared in this scope
   ev.sigev_notify = SIGEV_THREAD_ID;
                     ^~~~~~~~~~~~~~~
../src/plugins/node/prof/watchdog.h:252:21: note: suggested alternative: 'SIGEV_THREAD'
   ev.sigev_notify = SIGEV_THREAD_ID;
                     ^~~~~~~~~~~~~~~
                     SIGEV_THREAD
Release/obj.target/appmetrics/geni/appmetrics.cpp: In function 'void emitMessage(uv_async_t*, int)':
Release/obj.target/appmetrics/geni/appmetrics.cpp:451:44: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
         listener->callback->Call(argc, argv);
                                            ^
In file included from Release/obj.target/appmetrics/geni/appmetrics.cpp:22:
../../nan/nan.h:1740:3: note: declared here
   Call(int argc, v8::Local<v8::Value> argv[]) const {
   ^~~~
Release/obj.target/appmetrics/geni/appmetrics.cpp: In function 'void init(v8::Local<v8::Object>, v8::Local<v8::Object>)':
Release/obj.target/appmetrics/geni/appmetrics.cpp:735:65: warning: cast between incompatible function types from 'void (*)(uv_async_t*, int)' {aka 'void (*)(uv_async_s*, int)'} to 'uv_async_cb' {aka 'void (*)(uv_async_s*)'} [-Wcast-function-type]
     uv_async_init(uv_default_loop(), messageAsync, (uv_async_cb)emitMessage);
                                                                 ^~~~~~~~~~~
In file included from Release/obj.target/appmetrics/geni/appmetrics.cpp:21:
Release/obj.target/appmetrics/geni/appmetrics.cpp: At global scope:
/root/.node-gyp/10.15.3/include/node/node.h:570:43: warning: cast between incompatible function types from 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Object>)' to 'node::addon_register_func' {aka 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)'} [-Wcast-function-type]
       (node::addon_register_func) (regfunc),                          \
                                           ^
/root/.node-gyp/10.15.3/include/node/node.h:604:3: note: in expansion of macro 'NODE_MODULE_X'
   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
   ^~~~~~~~~~~~~
Release/obj.target/appmetrics/geni/appmetrics.cpp:790:1: note: in expansion of macro 'NODE_MODULE'
 NODE_MODULE(appmetrics, init)
 ^~~~~~~~~~~
In file included from /root/.node-gyp/10.15.3/include/node/node.h:63,
                 from Release/obj.target/appmetrics/geni/appmetrics.cpp:21:
/root/.node-gyp/10.15.3/include/node/v8.h: In instantiation of 'void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]':
/root/.node-gyp/10.15.3/include/node/node_object_wrap.h:85:78:   required from here
/root/.node-gyp/10.15.3/include/node/v8.h:9502:16: warning: cast between incompatible function types from 'v8::WeakCallbackInfo<node::ObjectWrap>::Callback' {aka 'void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)'} to 'Callback' {aka 'void (*)(const v8::WeakCallbackInfo<void>&)'} [-Wcast-function-type]
                reinterpret_cast<Callback>(callback), type);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/.node-gyp/10.15.3/include/node/v8.h: In instantiation of 'void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]':
../../nan/nan_object_wrap.h:65:61:   required from here
/root/.node-gyp/10.15.3/include/node/v8.h:9502:16: warning: cast between incompatible function types from 'v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback' {aka 'void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)'} to 'Callback' {aka 'void (*)(const v8::WeakCallbackInfo<void>&)'} [-Wcast-function-type]
make: *** [Makefile:282: Release/obj.target/appmetrics/geni/appmetrics.o] Error 1
make: Leaving directory '/usr/local/share/.config/yarn/global/node_modules/appmetrics/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 4.9.125-linuxkit
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/share/.config/yarn/global/node_modules/appmetrics
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.
The command '/bin/sh -c yarn global add appmetrics@5.0.0' returned a non-zero code: 1

Do you have any pointers what's wrong here? Can I do something in my dockerfile to make yarn global add appmetrics work?

I'm using yarn global add appmetrics to have a simpler reproducible example. I actually have an app that includes appmetrics version 3.x, 4.x or 5.x via package.json. Thank you for your help.

I did see the issues #438, RuntimeTools/appmetrics-statsd#11, #454, but could not extract any informaiton that would have made my example work.

@rwalle61 rwalle61 self-assigned this Jun 3, 2019
@rwalle61 rwalle61 added the bug label Jun 3, 2019
@rwalle61
Copy link
Contributor

rwalle61 commented Jun 3, 2019

I've managed to recreate the error; now investigating fixes

@rwalle61
Copy link
Contributor

rwalle61 commented Jun 4, 2019

So the error from the line ev._sigev_un._tid = profiler_tid; is the only one; commenting the block out (until return NULL) allows Appmetrics to compile and run, but without the watchdog feature (automatically turning on CPU profiling).

It seems to be that Linux Alpine is so trimmed down that the sigevent object does not have the _sigev_un property.

While we are investigating how to resolve this, you could comment the block out locally to get Appmetrics running without the watchdog feature.

@rwalle61
Copy link
Contributor

rwalle61 commented Jun 7, 2019

@meysholdt, we've disabled watchdog on linux alpine. Would you mind confirming whether this has resolved your issue?

@meysholdt
Copy link
Author

Thanks a lot for the fix!

Running docker build on the following Dockerfile succeeds for me:

FROM node:10.15.3-alpine

RUN apk add --no-cache --update \
    curl \
    python \
    build-base \
    libexecinfo-dev \
    libc6-compat \
    git

RUN git clone https://github.com/RuntimeTools/appmetrics.git
WORKDIR /appmetrics
RUN git submodule update --init --recursive

RUN npm install
RUN npm build
``

@meysholdt
Copy link
Author

:-D Will there be a release soon with this fix?

@MaxVynohradov
Copy link

Hi! Faced with this problem too. When will it be approximately fixed?

@utluiz
Copy link

utluiz commented Aug 27, 2019

I also stumbled on this error. Is there an ETA for the next release?

Update: after cloning latest master, I faced RuntimeTools/omr-agentcore#90

@mattcolegate
Copy link
Member

This issue is fixed in the latest release of Appmetrics (5.0.3). There is no currentl outlook on when RuntimeTools/omr-agentcore#90 will be fixed.

@utluiz
Copy link

utluiz commented Aug 27, 2019

Thank you for the update.
FWIW I've worked around this issue by switching to ubuntu:18.04 instead of Alpine Linux. It increases the image size in about 6 times (~5MB to ~29M) but it's not the end of the world.

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

No branches or pull requests

5 participants