RuntimeTools/appmetrics

appmetrics causes BX CF start failure

Closed this issue · 10 comments

I got the following error. Please let me know how to work around:

2017-10-31T12:41:31.75-0400 [APP/PROC/WEB/0]ERR [Tue Oct 31 16:41:31 2017] com.ibm.diagnostics.healthcenter.loader INFO: Node Application Metrics 3.1.1.201710160434 (Agent Core 3.2.4)
2017-10-31T12:41:31.87-0400 [APP/PROC/WEB/0]ERR [Tue Oct 31 16:41:31 2017] com.ibm.diagnostics.healthcenter.mqtt INFO: Connecting to broker localhost:1883
2017-10-31T12:41:33.47-0400 [APP/PROC/WEB/0]ERR /home/vcap/app/node_modules/mongodb/lib/mongo_client.js:369
2017-10-31T12:41:33.47-0400 [APP/PROC/WEB/0]ERR throw err
2017-10-31T12:41:33.47-0400 [APP/PROC/WEB/0]ERR ^
2017-10-31T12:41:33.47-0400 [APP/PROC/WEB/0]ERR RangeError: Maximum call stack size exceeded
2017-10-31T12:41:33.47-0400 [APP/PROC/WEB/0]ERR at Object.stringify (native)
2017-10-31T12:41:33.47-0400 [APP/PROC/WEB/0]ERR at Function.Module._findPath (module.js:158:25)
2017-10-31T12:41:33.47-0400 [APP/PROC/WEB/0]ERR at Function.Module._resolveFilename (module.js:467:25)
2017-10-31T12:41:33.47-0400 [APP/PROC/WEB/0]ERR at Function.Module._load (module.js:417:25)
2017-10-31T12:41:33.47-0400 [APP/PROC/WEB/0]ERR at Module.require (module.js:497:17)
2017-10-31T12:41:33.47-0400 [APP/PROC/WEB/0]ERR at Module.newFunc (/home/vcap/app/node_modules/appmetrics/lib/aspect.js:101:26)
2017-10-31T12:41:33.47-0400 [APP/PROC/WEB/0]ERR at require (internal/module.js:20:19)
2017-10-31T12:41:33.47-0400 [APP/PROC/WEB/0]ERR at Object.exports.monitor (/home/vcap/app/node_modules/appmetrics-dash/lib/appmetrics-dash.js:99:42)
2017-10-31T12:41:33.47-0400 [APP/PROC/WEB/0]ERR at Object.exports.monitor (/home/vcap/app/node_modules/appmetrics-dash/lib/appmetrics-dash.js:103:31)
2017-10-31T12:41:33.47-0400 [APP/PROC/WEB/0]ERR at Object.http.Server (/home/vcap/app/node_modules/appmetrics-dash/lib/appmetrics-dash.js:69:15)
2017-10-31T12:41:33.52-0400 [APP/PROC/WEB/0]ERR npm ERR! Linux 4.4.0-75-generic
2017-10-31T12:41:33.52-0400 [APP/PROC/WEB/0]ERR npm ERR! argv "/home/vcap/app/vendor/node/bin/node" "/home/vcap/app/vendor/node/bin/npm" "start"
2017-10-31T12:41:33.52-0400 [APP/PROC/WEB/0]ERR npm ERR! node v6.11.4
2017-10-31T12:41:33.52-0400 [APP/PROC/WEB/0]ERR npm ERR! npm v3.10.10
2017-10-31T12:41:33.52-0400 [APP/PROC/WEB/0]ERR npm ERR! code ELIFECYCLE
2017-10-31T12:41:33.52-0400 [APP/PROC/WEB/0]ERR npm ERR! acmeair_flight@0.1.0 start: node flightservice_app.js
2017-10-31T12:41:33.52-0400 [APP/PROC/WEB/0]ERR npm ERR! Exit status 1
2017-10-31T12:41:33.52-0400 [APP/PROC/WEB/0]ERR npm ERR!
2017-10-31T12:41:33.52-0400 [APP/PROC/WEB/0]ERR npm ERR! Failed at the acmeair_flight@0.1.0 start script 'node flightservice_app.js'.
2017-10-31T12:41:33.52-0400 [APP/PROC/WEB/0]ERR npm ERR! Make sure you have the latest version of node.js and npm installed.
2017-10-31T12:41:33.52-0400 [APP/PROC/WEB/0]ERR npm ERR! If you do, this is most likely a problem with the acmeair_flight package,
2017-10-31T12:41:33.52-0400 [APP/PROC/WEB/0]ERR npm ERR! not with npm itself.
2017-10-31T12:41:33.52-0400 [APP/PROC/WEB/0]ERR npm ERR! Tell the author that this fails on your system:
2017-10-31T12:41:33.52-0400 [APP/PROC/WEB/0]ERR npm ERR! node flightservice_app.js
2017-10-31T12:41:33.52-0400 [APP/PROC/WEB/0]ERR npm ERR! You can get information on how to open an issue for this project with:
2017-10-31T12:41:33.52-0400 [APP/PROC/WEB/0]ERR npm ERR! npm bugs acmeair_flight
2017-10-31T12:41:33.53-0400 [APP/PROC/WEB/0]ERR npm ERR! Or if that isn't available, you can get their info via:
2017-10-31T12:41:33.53-0400 [APP/PROC/WEB/0]ERR npm ERR! npm owner ls acmeair_flight
2017-10-31T12:41:33.53-0400 [APP/PROC/WEB/0]ERR npm ERR! There is likely additional logging output above.
2017-10-31T12:41:33.54-0400 [APP/PROC/WEB/0]ERR npm ERR! Please include the following file with any support request:
2017-10-31T12:41:33.54-0400 [APP/PROC/WEB/0]ERR npm ERR! /home/vcap/app/npm-debug.log

@mossuchida are you able to supply the /home/vcap/app/npm-debug.log file? Also can you describe the program you are attempting to run and/or provide source files for diagnostics? It looks like you're attempting to run AcmeAir on Bluemix - did you enable Appmetrics via environment variable?

I have followed the steps in this article : https://developer.ibm.com/node/2017/03/23/use-appmetrics-dash-bluemix-3-easy-steps/

The app is in GHE : https://github.ibm.com/ibmperf/flightservice-node
I used compose Mongo DB (set the DB info in settings.json)

@mossuchida Thanks for the GHE link - can you provide some instructions on how to get it running? The README says to use Bluemix_CF.sh or Bluemix_Container.sh but neither of those are present. Were you using CloudFoundry or Containers when the error occured?

oops, sorry, docs are not updated. Please deploy to CF. I used the command : "bx cf push moss-node-test -m 256M" after adding some DB info (you can get 30 days free trial from Compose)

@mossuchida I've not managed to find the time to get your application working so that I can recreate it. As an interim, the stack trace looked like the failure occurred during instrumentation of MongoDB. To prove this, can you turn MongoDB instrumentation off by replacing the lines of code you added to your application in step 2 of https://developer.ibm.com/node/2017/03/23/use-appmetrics-dash-bluemix-3-easy-steps/ with the following and re-running please?

var appm = require('appmetrics');
require('appmetrics-dash').attach({appmetrics:appm});
appm.disable('mongo');

It worked when disabled mongo. Here is the dashboard : http://moss-node-test.mybluemix.net/appmetrics-dash/

@mossuchida That's good to know. There was a typo in the article that may have been causing the problem - can you remove just the appm.disable('mongo'); line, keeping the other two lines above and retest please?

btw, CPU & mem usages are wrong in the graph. appmetrics graph shows lots of CPU util & Mem is 31G used, but this is what I get from CF command : state since cpu memory disk details
#0 running 2017-11-09T17:34:03Z 0.4% 68.6M of 256M 161.1M of 1G

So, CPU = 0.4%, mem = 68.6M

okay it worked with:
var appm = require('appmetrics');
require('appmetrics-dash').attach({appmetrics:appm});

@mossuchida That's great! The article has been updated accordingly and I'll close this and RuntimeTools/appmetrics-dash#123.
We're currently investigating the CPU issue. System memory shows total available rather than used, so a re-jig to the legend is in order for that graph. Thanks for your help!