Giter Site home page Giter Site logo

cluster2's Introduction

What is cluster2

Travis status

NOTE: For node (<=0.6.x), use cluster2 version 0.3.1

cluster2 is a node.js (>= 0.8.x) compatible multi-process management module. This module grew out of our needs in operationalizing node.js for ql.io at eBay. Built on node's cluster, cluster2 adds several safeguards and utility functions to help support real-world production scenarios:

  • Scriptable start, shutdown and stop flows
  • Worker monitoring for process deaths
  • Worker recycling
  • Graceful shutdown
  • Idle timeouts
  • Validation hooks (for other tools to monitor cluster2 apps)
  • Events for logging cluster activities
  • Exit with error code when the port is busy to fail start scripts
  • Disable monitor
  • and more coming soon

Usage

Getting cluster2

npm install cluster2

Start a TCP Server

var Cluster = require('cluster2'),
    net = require('net');
var server = net.createServer(function (c) {
    c.on('end', function () {
        console.log('server disconnected');
    });
    c.write('hello\r\n');
    c.pipe(c);
});

var c = new Cluster({
    port: 3000,
    cluster: true
});
c.listen(function(cb) {
    cb(server);
});

Start a HTTP Server

var Cluster = require('cluster2'),
    http = require('http');
var server = http.createServer(function (req, res) {
    res.writeHead(200);
    res.end('hello');
});
var c = new Cluster({
    port: 3000
});
c.listen(function(cb) {
    cb(server);
});

Start an Express Server

var Cluster = require('cluster2'),
    express = require('express');
var app = express.createServer();
app.get('/', function(req, res) {
    res.send('hello');
});

var c = new Cluster({
    port: 3000,
});
c.listen(function(cb) {
    cb(app);
});

Stop a Server

var Cluster = require('cluster2');
var c = new Cluster();
c.stop();

Gracefully Shutdown a Server

var Cluster = require('cluster2');
var c = new Cluster();
c.shutdown();

Options

Cluster2 takes the following options.

  • cluster: When true starts a number of workers. Use false to start the server as a single process. Defaults to true.
  • pids: A directory to write PID files for master and workers.
  • port: Port number for the app, defaults to 3000.
  • host: Hostname or IP for the app listening, defaults to 0.0.0.0.
  • monHost: Hostname or IP for the monitor listening, defaults to 0.0.0.0.
  • monPort: Port number for the monitor URL, defaults to 3001. Go to http://<localhost>:3001 to view application logs (whatever is written to a /logs dir), and npm dependencies.
  • ecv: ECV stands for "extended content verification". This is an object with the following additional properties:
    • path: A path to serve a heart beat. See below.
    • monitor: A URI to check before emitting a valid heart beat signal
    • control: When true, allows clients to enable or disable the signal. See below. validator to validate the runtime health of the app. If found unhealthy, emits a disable
  • noWorkers: Defaults to os.cpus().length.
  • timeout: Idle socket timeout. Automatically ends incoming sockets if found idle for this duration. Defaults to 30 seconds.
  • connThreshold: When the number of connections processed exceeds this numbers, recycle the worker process. This can help recover from slow leaks in your code or dependent modules.

Graceful Shutdown

The purpose of shutdown() is to let the server reject taking new connections, handle all pending requests and end the connecton so that no request dropped. In order to handling shutdown(), the server must handle close events as follows.

var serving = true;
var server = http.createServer(function (req, res) {
    if(!serving) {
        // Be nice and send a connection: close as otherwise the client may pump more requests
        // on the same connection
        res.writeHead(200, {
            'connection': 'close'
        });
    }
    res.writeHead(200);
    res.end('hello');
});
server.on('close', function() {
    serving = false;
})
var c = new Cluster({
    port: 3000,
    cluster: true
});

Completion of shutdown() does not necessarily mean that all worker processes are dead immediately. The workers may take a while to complete processing of current requests and exit. The shutdown() flow only guarantees that the server takes no new connections.

Cluster2 Events

Cluster2 is an EventEmitter and emits the following events.

  • died: Emitted when a worker dies. This event is also emitted during normal shutdown() or stop().
  • forked: Emitted when a new worker is forked.
  • <signal>: Emitted when a worker receives a signal (such as SIGKILL, SIGTERM or SIGINT).

Here is an example that logs these events to the disk.

var Cluster = require('cluster2'),
    http = require('http');

var server = http.createServer(function (req, res) {
    res.writeHead(200);
    res.end('hello');
});
var c = new Cluster({
    cluster: true,
    port: 3000,
    host: 'localhost'
});
c.on('died', function(pid) {
    console.log('Worker ' + pid + ' died');
});
c.on('forked', function(pid) {
    console.log('Worker ' + pid + ' forked');
});
c.on('SIGKILL', function() {
    console.log('Got SIGKILL');
});
c.on('SIGTERM', function(event) {
    console.log('Got SIGTERM - shutting down');
});
c.on('SIGINT', function() {
    console.log('Got SIGINT');
});
c.listen(function(cb) {
    cb(server);
});

Routing Traffic

It is fairly common for proxies or load balancers deployed in front of node clusters, and those proxies to use monitor URLs to detect the health of the cluster. Cluster2 includes a monitor at http://<host>:<port>/ecv. You can change this by setting the path property when initializing the cluster.

In case you want to take the node cluster out of rotation from the proxy/load balancer, you can do so by setting control to true when initializing the cluster. At runtime, you can send a POST request to http://<host>:<port>/ecv/disable. Once this is done, further requests to http://<host>:<port>/ecv will get a network error. You can bring the cluster back to rotation by sending a POST request to http://<host>:<port>/ecv/enable.

Since it will be potentially disastrous to let artibrary clients enable/disable traffic, you should configure your proxy/load balancer to prevent external traffic to /ecv*.

To test this, bring up an example

node examples/express/express-server.js

and send a GET request to http://localhost:3000/ecv and notice the response.

HTTP/1.1 200 OK
X-Powered-By: Cluster2
content-type: text/plain
since: Fri May 18 2012 09:49:32 GMT-0700 (PDT)
cache-control: no-cache
Connection: keep-alive
Transfer-Encoding: chunked

status=AVAILABLE&ServeTraffic=true&ip=127.0.0.1&hostname=somehost&port=3000&time=Fri May 18 2012 09:49:49 GMT-0700 (PDT)

To flip the monitor into a disabled state, send a POST request to http://localhost:3000/disable.

HTTP/1.1 204 No Content
X-Powered-By: Cluster2
since: Fri May 18 2012 09:54:25 GMT-0700 (PDT)
cache-control: no-cache
Connection: close

Subsequent GET requests to http://localhost:3000/ecv will return a response similar to the one below.

HTTP/1.1 400 Bad Request
X-Powered-By: Cluster2
content-type: text/plain
since: Fri May 18 2012 09:54:25 GMT-0700 (PDT)
cache-control: no-cache
Connection: close
Transfer-Encoding: chunked

status=DISABLED&ServeTraffic=false&ip=127.0.0.1&hostname=somehost&port=3000&time=Fri May 18 2012 09:55:17 GMT-0700 (PDT)

To flip the monitor back into an enabled state, send a POST request to http://localhost:3000/enable.

NOTE for 0.4.0 version The major change is to support a general work delegation pattern between workers & master. In a few scenarios, we've seen duplicate work done by each worker, that could be delegated to master to address and avoid the duplication of effort. And to make it general enough, we defined the following delegation pattern: worker -> master : message message.type is "delegate" message.delegate defines the actual message type message.expect is optional, if not given, the delegate work is silently handled by master (e.g. logging remotely); if given, worker will expect a response message whose type must equal message.expect; if given expect, the following will be enabled: message.matches defines the matching criteria of the response message, message.timeout defines the max timeout of the delegate work. message.notification allows delegated work to publish changes detected later. message.origin keeps the orginal message. In cluster2, after master receives the message from worker, it would turn it into an event message, and find the proper listener to handle such. The event handler could be config reader, remote logger, resource externalizer e.g. and they might/might not respond to master based on the expect.

cluster2's People

Contributors

cliffano avatar dimichgh avatar hochang avatar inexplicable avatar patrick-steele-idem avatar prabhakhar avatar shimonchayim avatar zhuchenwang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cluster2's Issues

npm install failed

I failed to install cluster2 using npm install cluster2

My setup:

npm 7.10.0
node v16.0.0
macOS 11.3
MacBook Air M1 2020

Output:

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '[email protected]',
npm WARN EBADENGINE   required: { node: '>=0.6', npm: '1' },
npm WARN EBADENGINE   current: { node: 'v16.0.0', npm: '7.10.0' }
npm WARN EBADENGINE }
npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated [email protected]: express 2.x series is deprecated
npm WARN deprecated [email protected]: Critical security bugs fixed in 2.5.5
npm WARN deprecated [email protected]: connect 1.x series is deprecated
npm ERR! code 1
npm ERR! path /Users/.../cluster-test/node_modules/usage
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! CXX(target) Release/obj.target/sysinfo/src/binding.o
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info find Python using Python version 3.9.4 found at "/opt/homebrew/opt/[email protected]/bin/python3.9"
npm ERR! (node:67193) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp info spawn /opt/homebrew/opt/[email protected]/bin/python3.9
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/.../cluster-test/node_modules/usage/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/.../Library/Caches/node-gyp/16.0.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/Users/.../Library/Caches/node-gyp/16.0.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/.../Library/Caches/node-gyp/16.0.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/.../cluster-test/node_modules/usage',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! ../src/binding.cpp:5:21: error: no template named 'Handle'
npm ERR! void RegisterModule(Handle<Object> target) {
npm ERR!                     ^
npm ERR! ../src/binding.cpp:17:25: error: no member named 'NewSymbol' in 'v8::String'
npm ERR!     target->Set(String::NewSymbol("OS"), String::New(OS));
npm ERR!                 ~~~~~~~~^
npm ERR! ../src/binding.cpp:17:50: error: no member named 'New' in 'v8::String'
npm ERR!     target->Set(String::NewSymbol("OS"), String::New(OS));
npm ERR!                                          ~~~~~~~~^
npm ERR! 3 errors generated.
npm ERR! make: *** [Release/obj.target/sysinfo/src/binding.o] Error 1
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:365:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Darwin 20.4.0
npm ERR! gyp ERR! command "/opt/homebrew/Cellar/node/16.0.0/bin/node" "/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /Users/.../github/playgra/cluster-test/node_modules/usage
npm ERR! gyp ERR! node -v v16.0.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/.../.npm/_logs/2021-04-30T14_04_35_217Z-debug.log...

replace specific domain socket with axon req/res pattern

https://npmjs.org/package/axon this is to replace the usage of domain socket with axon, which is tcp based, well, in theory, tcp connection will be slower than domain socket, but in localhost, the margin is limited, and it will be impossible for windows, overall, we could switch to axon library, where req/res, pub/sub are well supported.
this should begin as an evaluation, performance wise, and see how much less code we could write. overall this should reduce the maintenance effort.

once evaluated, we'll need to update cache-mgr, cache-usr, and cache-common to use axon. api shouldn't be affected at all.

generalize warmup port usage as 'routing' port

on 'cluster3' branch, we already used 'warmUpPort' to assign each worker a different port for the purpose of a guaranteed warmup, there're couple of more use cases which we think require this pattern to be generalized, after all, a dedicated port is for the sake of routing traffic to a specific worker (as it alone listens on that port)

some sample use cases are:

  1. testing a specific worker
  2. using server-sent event for logging, which requires a url that would route to a deterministic worker process

test nanny feature

nanny feature is to verify that all workers are responsive, we need a test case to verify when a worker failed to produce heartbeat over 3 mins, master will force a kill of this worker.

Use template-literal instead of EJS

Template Literal is fastest, smallest and simplest template engine, because it use JS's literal template feature.

It's 55 times faster than EJS, and it also use less CPU and RAM ressources, so it may be a good idea to use it instead of EJS 😀

Cluster2 fails to build on node>=v0.11.4

Hi, just got this error, after several tries of building cluster2, changing node versions around to see where it fails:

$ npm install cluster2
npm http GET https://registry.npmjs.org/cluster2
npm http 200 https://registry.npmjs.org/cluster2
npm http GET https://registry.npmjs.org/cluster2/-/cluster2-0.4.25.tgz
npm http 200 https://registry.npmjs.org/cluster2/-/cluster2-0.4.25.tgz
npm http GET https://registry.npmjs.org/underscore
npm http GET https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/ejs
npm http GET https://registry.npmjs.org/npm
npm http GET https://registry.npmjs.org/when
npm http GET https://registry.npmjs.org/usage
npm http GET https://registry.npmjs.org/bignumber.js
npm http GET https://registry.npmjs.org/gc-stats
npm http 200 https://registry.npmjs.org/underscore
npm http GET https://registry.npmjs.org/underscore/-/underscore-1.4.4.tgz
npm http 200 https://registry.npmjs.org/when
npm http GET https://registry.npmjs.org/when/-/when-2.4.0.tgz
npm http 200 https://registry.npmjs.org/gc-stats
npm http GET https://registry.npmjs.org/gc-stats/-/gc-stats-0.0.1.tgz
npm http 200 https://registry.npmjs.org/ejs
npm http GET https://registry.npmjs.org/ejs/-/ejs-0.8.8.tgz
npm http 200 https://registry.npmjs.org/bignumber.js
npm http GET https://registry.npmjs.org/bignumber.js/-/bignumber.js-1.1.1.tgz
npm http 200 https://registry.npmjs.org/usage
npm http GET https://registry.npmjs.org/usage/-/usage-0.3.9.tgz
npm http 200 https://registry.npmjs.org/underscore/-/underscore-1.4.4.tgz
npm http 200 https://registry.npmjs.org/when/-/when-2.4.0.tgz
npm http 200 https://registry.npmjs.org/gc-stats/-/gc-stats-0.0.1.tgz
npm http 200 https://registry.npmjs.org/ejs/-/ejs-0.8.8.tgz
npm http 200 https://registry.npmjs.org/bignumber.js/-/bignumber.js-1.1.1.tgz
npm http 200 https://registry.npmjs.org/express
npm http 200 https://registry.npmjs.org/usage/-/usage-0.3.9.tgz
npm http GET https://registry.npmjs.org/express/-/express-2.5.11.tgz
npm http 200 https://registry.npmjs.org/npm
npm http GET https://registry.npmjs.org/npm/-/npm-1.3.26.tgz
npm http 200 https://registry.npmjs.org/express/-/express-2.5.11.tgz
npm http 200 https://registry.npmjs.org/npm/-/npm-1.3.26.tgz

> [email protected] install /home/karolyi/test/node_modules/cluster2/node_modules/gc-stats
> node-gyp rebuild

npm http GET https://registry.npmjs.org/bindings
npm http GET https://registry.npmjs.org/connect
npm http GET https://registry.npmjs.org/mime/1.2.4
npm http GET https://registry.npmjs.org/qs
npm http GET https://registry.npmjs.org/mkdirp/0.3.0
npm http 200 https://registry.npmjs.org/bindings
npm http GET https://registry.npmjs.org/bindings/-/bindings-1.2.0.tgz
make: Entering directory `/home/karolyi/test/node_modules/cluster2/node_modules/gc-stats/build'
npm http 200 https://registry.npmjs.org/qs
  CXX(target) Release/obj.target/gcstats/src/gcstats.o
npm http GET https://registry.npmjs.org/qs/-/qs-0.4.2.tgz
In file included from /home/karolyi/.node-gyp/0.11.4/src/node.h:62:0,
                 from ../src/gcstats.cc:1:
/home/karolyi/.node-gyp/0.11.4/deps/v8/include/v8.h: In member function ‘void v8::ReturnValue<T>::Set(uint32_t)’:
/home/karolyi/.node-gyp/0.11.4/deps/v8/include/v8.h:5810:31: warning: typedef ‘I’ locally defined but not used [-Wunused-local-typedefs]
   typedef internal::Internals I;
                               ^
../src/gcstats.cc: In function ‘void recordBeforeGC(v8::GCType, v8::GCCallbackFlags)’:
../src/gcstats.cc:30:38: warning: ‘static void v8::V8::GetHeapStatistics(v8::HeapStatistics*)’ is deprecated (declared at /home/karolyi/.node-gyp/0.11.4/deps/v8/include/v8.h:4639) [-Wdeprecated-declarations]
  V8::GetHeapStatistics(&beforeGCStats);
                                      ^
In file included from /home/karolyi/.node-gyp/0.11.4/src/node.h:62:0,
                 from ../src/gcstats.cc:1:
/home/karolyi/.node-gyp/0.11.4/deps/v8/include/v8.h: In function ‘void asyncAfter(uv_work_t*, int)’:
/home/karolyi/.node-gyp/0.11.4/deps/v8/include/v8.h:771:16: error: ‘T* v8::Persistent<T>::operator->() const [with T = v8::Function]’ is private
   V8_INLINE(T* operator->() const) { return val_; }
                ^
/home/karolyi/.node-gyp/0.11.4/deps/v8/include/v8.h:80:69: note: in definition of macro ‘V8_INLINE’
 #define V8_INLINE(declarator) inline __attribute__((always_inline)) declarator
                                                                     ^
../src/gcstats.cc:82:17: error: within this context
  afterGCCallback->Call(callbackContext, 1, arguments);
                 ^
../src/gcstats.cc:82:53: error: no matching function for call to ‘v8::Function::Call(v8::Persistent<v8::Object>&, int, v8::Handle<v8::Value> [1])’
  afterGCCallback->Call(callbackContext, 1, arguments);
                                                     ^
../src/gcstats.cc:82:53: note: candidate is:
In file included from /home/karolyi/.node-gyp/0.11.4/src/node.h:62:0,
                 from ../src/gcstats.cc:1:
/home/karolyi/.node-gyp/0.11.4/deps/v8/include/v8.h:2336:16: note: v8::Local<v8::Value> v8::Function::Call(v8::Handle<v8::Object>, int, v8::Handle<v8::Value>*)
   Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]);
                ^
/home/karolyi/.node-gyp/0.11.4/deps/v8/include/v8.h:2336:16: note:   no known conversion for argument 1 from ‘v8::Persistent<v8::Object>’ to ‘v8::Handle<v8::Object>’
../src/gcstats.cc: In function ‘void afterGC(v8::GCType, v8::GCCallbackFlags)’:
../src/gcstats.cc:102:30: warning: ‘static void v8::V8::GetHeapStatistics(v8::HeapStatistics*)’ is deprecated (declared at /home/karolyi/.node-gyp/0.11.4/deps/v8/include/v8.h:4639) [-Wdeprecated-declarations]
  V8::GetHeapStatistics(&stats);
                              ^
../src/gcstats.cc: In function ‘v8::Handle<v8::Value> AfterGC(const v8::Arguments&)’:
../src/gcstats.cc:124:54: error: no matching function for call to ‘v8::Persistent<v8::Function>::New(v8::Handle<v8::Function>&)’
  afterGCCallback = Persistent<Function>::New(callback);
                                                      ^
../src/gcstats.cc:124:54: note: candidate is:
In file included from /home/karolyi/.node-gyp/0.11.4/src/node.h:62:0,
                 from ../src/gcstats.cc:1:
/home/karolyi/.node-gyp/0.11.4/deps/v8/include/v8.h:5585:4: note: static T* v8::Persistent<T>::New(v8::Isolate*, T*) [with T = v8::Function]
 T* Persistent<T>::New(Isolate* isolate, T* that) {
    ^
/home/karolyi/.node-gyp/0.11.4/deps/v8/include/v8.h:5585:4: note:   candidate expects 2 arguments, 1 provided
../src/gcstats.cc:125:76: error: no matching function for call to ‘v8::Persistent<v8::Object>::New(v8::Local<v8::Object>)’
  callbackContext  = Persistent<Object>::New(Context::GetCalling()->Global());
                                                                            ^
../src/gcstats.cc:125:76: note: candidate is:
In file included from /home/karolyi/.node-gyp/0.11.4/src/node.h:62:0,
                 from ../src/gcstats.cc:1:
/home/karolyi/.node-gyp/0.11.4/deps/v8/include/v8.h:5585:4: note: static T* v8::Persistent<T>::New(v8::Isolate*, T*) [with T = v8::Object]
 T* Persistent<T>::New(Isolate* isolate, T* that) {
    ^
/home/karolyi/.node-gyp/0.11.4/deps/v8/include/v8.h:5585:4: note:   candidate expects 2 arguments, 1 provided
../src/gcstats.cc: In function ‘void init(v8::Handle<v8::Object>)’:
../src/gcstats.cc:134:74: warning: ‘static v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::InvocationCallback, v8::Handle<v8::Value>, v8::Handle<v8::Signature>, int)’ is deprecated (declared at /home/karolyi/.node-gyp/0.11.4/deps/v8/include/v8.h:3263) [-Wdeprecated-declarations]
  exports->Set(String::NewSymbol("afterGC"), FunctionTemplate::New(AfterGC)->GetFunction());
                                                                          ^
make: *** [Release/obj.target/gcstats/src/gcstats.o] Error 1
make: Leaving directory `/home/karolyi/test/node_modules/cluster2/node_modules/gc-stats/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/karolyi/.nvm/v0.11.4/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR!npm http 200 https://registry.npmjs.org/mime/1.2.4
 stack     at ChildProcess.EventEmitter.emit (events.js:103:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.13.0-24-generic
gyp ERR! command "node" "/home/karolyi/.nvm/v0.11.4/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! npm http GET https://registry.npmjs.org/mime/-/mime-1.2.4.tgz
cwd /home/karolyi/test/node_modules/cluster2/node_modules/gc-stats
gyp ERR! node -v v0.11.4
gyp ERR! node-gyp -v v0.10.6
gyp ERR! not ok 
npm http 200 https://registry.npmjs.org/mkdirp/0.3.0
npm http GET https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz
npm ERR! Error: ENOENT, lstat '/home/karolyi/test/node_modules/cluster2/node_modules/npm/lib/submodule.js'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/home/karolyi/.nvm/v0.11.4/bin/node" "/home/karolyi/.nvm/v0.11.4/bin/npm" "install" "cluster2"
npm ERR! cwd /home/karolyi/test
npm ERR! node -v v0.11.4
npm ERR! npm -v 1.3.4
npm ERR! path /home/karolyi/test/node_modules/cluster2/node_modules/npm/lib/submodule.js
npm ERR! fstream_path /home/karolyi/test/node_modules/cluster2/node_modules/npm/lib/submodule.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /home/karolyi/.nvm/v0.11.4/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:94:15)
npm http 200 https://registry.npmjs.org/bindings/-/bindings-1.2.0.tgz
npm http 200 https://registry.npmjs.org/qs/-/qs-0.4.2.tgz
npm ERR! weird error 1
npm ERR! EEXIST, mkdir '/home/karolyi/tmp/npm-498-EFOxySg-/1399639421737-0.11779368296265602/package'
File exists: /home/karolyi/tmp/npm-498-EFOxySg-/1399639421737-0.11779368296265602/package
Move it away, and try again. 

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/home/karolyi/.nvm/v0.11.4/bin/node" "/home/karolyi/.nvm/v0.11.4/bin/npm" "install" "cluster2"
npm ERR! cwd /home/karolyi/test
npm ERR! node -v v0.11.4
npm ERR! npm -v 1.3.4
npm ERR! path /home/karolyi/tmp/npm-498-EFOxySg-/1399639421737-0.11779368296265602/package
npm ERR! fstream_path /home/karolyi/tmp/npm-498-EFOxySg-/1399639421737-0.11779368296265602/package/.gitignore
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code EEXIST
npm ERR! errno 47
npm ERR! fstream_stack /home/karolyi/.nvm/v0.11.4/lib/node_modules/npm/node_modules/fstream/lib/writer.js:171:23
npm ERR! fstream_stack /home/karolyi/.nvm/v0.11.4/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:94:15)
npm ERR! Error: ENOENT, lstat '/home/karolyi/tmp/npm-498-EFOxySg-/1399639421726-0.31578966532833874/package/README.md'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/home/karolyi/.nvm/v0.11.4/bin/node" "/home/karolyi/.nvm/v0.11.4/bin/npm" "install" "cluster2"
npm ERR! cwd /home/karolyi/test
npm ERR! node -v v0.11.4
npm ERR! npm -v 1.3.4
npm ERR! path /home/karolyi/tmp/npm-498-EFOxySg-/1399639421726-0.31578966532833874/package/README.md
npm ERR! fstream_path /home/karolyi/tmp/npm-498-EFOxySg-/1399639421726-0.31578966532833874/package/README.md
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /home/karolyi/.nvm/v0.11.4/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:94:15)
npm ERR! Error: ENOENT, lstat '/home/karolyi/test/node_modules/cluster2/node_modules/bignumber.js/test/round.js'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/home/karolyi/.nvm/v0.11.4/bin/node" "/home/karolyi/.nvm/v0.11.4/bin/npm" "install" "cluster2"
npm ERR! cwd /home/karolyi/test
npm ERR! node -v v0.11.4
npm ERR! npm -v 1.3.4
npm ERR! path /home/karolyi/test/node_modules/cluster2/node_modules/bignumber.js/test/round.js
npm ERR! fstream_path /home/karolyi/test/node_modules/cluster2/node_modules/bignumber.js/test/round.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /home/karolyi/.nvm/v0.11.4/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:94:15)
npm http 200 https://registry.npmjs.org/mime/-/mime-1.2.4.tgz
npm http 200 https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz
npm http 200 https://registry.npmjs.org/connect
npm http GET https://registry.npmjs.org/connect/-/connect-1.9.2.tgz
npm http 200 https://registry.npmjs.org/connect/-/connect-1.9.2.tgz
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/karolyi/test/npm-debug.log
npm ERR! not ok code 0

$ nvm ls
        .nvm
     v0.11.0
     v0.11.2
     v0.11.3
->   v0.11.4
    v0.11.10
    v0.11.12
    v0.11.13

Force a connection to a server

There is absolutely no possibility to force a connection to a specific worker, i mean (for instance) this xlmHttpRequest must be handle by worker X ?

===== edit
Stupid question. I found a work-around.

The dependency usage: ~0.3.8 cause build errors on windows

npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the usage package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs usage
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls usage
npm ERR! There is likely additional logging output above.

Is there anyway this could be updated to use the latest version of "usage" dependency? It does appear to work on WIndows.

C:\dev\clustertest>npm install usage --save

[email protected] install C:\dev\clustertest\node_modules\usage
node-gyp rebuild

Thanks!

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.