LearnBoost / cluster

Node.JS multi-core server manager with plugins support.
http://learnboost.github.com/cluster
MIT License
2.29k stars 159 forks source link

connection stats throw if app is given as filename #65

Closed bkw closed 13 years ago

bkw commented 13 years ago

Seems the new connection option for the stats plugin only works if app is already initialized, not if it is given as a filename.

node.js:178
    throw e; // process.nextTick error, or 'error' event on first tick
    ^
    throw e; // process.nextTick error, or 'error' event on first tick
    ^
TypeError: Object ./app has no method 'on' at stats ([dir]/deps/cluster/lib/plugins/stats.js:51:16)
  at Master.use ([dir]/deps/cluster/lib/master.js:337:32)
  at Object.<anonymous> ([dir]/server.js:23:6)
  at Module._compile (module.js:404:26)
  at Object..js (module.js:410:10)
  at Module.load (module.js:336:31)
  at Function._load (module.js:297:12)
  at Array.<anonymous> (module.js:423:10)
  at EventEmitter._tickCallback (node.js:170:26)
tj commented 13 years ago

resolve server path in worker sooner. Closed by 3816b6986d4f7a437d805c0278d08278cc2081aa [reported by bkw]

diversario commented 13 years ago

I'm having this same issue. My cluster.js:

"use strict";

var cluster = require('cluster'),
    config = require('./config'),
    live = require('cluster-live'),
    app = exports.app = require('./server').app;

cluster('./server')
        .use(cluster.logger('/node/log'))
        .use(cluster.pidfiles('/node/pids'))
        .use(cluster.cli())
        .use(cluster.reload())
        .use(cluster.debug())
        .use(cluster.repl(8889))
        .use(cluster.stats({ connections: true, lightRequests: true }))
        .use(live({"hostname": '123.45.68.9', "user": "user", "pass": "pass"}))
        .listen(config.http_server_port, config.http_server_address);

getting this:

TypeError: Object #<Object> has no method 'on'
    at stats (/node/node_modules/cluster/lib/plugins/stats.js:53:16)
    at Master.use (/node/node_modules/cluster/lib/master.js:404:32)
    at Object.<anonymous> (/node/cluster.js:15:3)
    at Module._compile (module.js:402:26)
    at Object..js (module.js:408:10)
    at Module.load (module.js:334:31)
    at Function._load (module.js:293:12)
    at Array.<anonymous> (module.js:421:10)
    at EventEmitter._tickCallback (node.js:126:26)

continuosly. It actually locked up my Rackspace cloudserver, had to call in to reboot it because CPU was at 100%.

diversario commented 13 years ago

Oh, wait! Damn, that's embarassing - I'm passing cluster a filename instead of defined variable. Sorry. Derp!