Giter Site home page Giter Site logo

clusterflock's Introduction

Hello, I'm Jonathan.

πŸ‘¨β€πŸ’» I'm an engineer, formerly at @github, @dropbox, @usecanvas, @heroku. Next, something new.
πŸ‘‰ My pronouns are β€œhe”/β€œhim”.

πŸ“¬ You can reach me by emailing me.

clusterflock's People

Contributors

jclem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

clusterflock's Issues

SIGTERM doesn't shut down processes

I run an express app with clusterflock like so:

$ node server.js 
ns=clusterflock pid=4635 type=master evt="starting master"
ns=clusterflock pid=4637 type=worker evt="starting worker"
ns=clusterflock pid=4635 type=master evt="clusterflock is listening on port 5000"
ns=clusterflock pid=4636 type=worker evt="starting worker"
ns=clusterflock pid=4638 type=worker evt="starting worker"
ns=clusterflock pid=4639 type=worker evt="starting worker"

The processes look like this:

$ ps
  PID TTY           TIME CMD
  467 ttys000    0:00.85 -bash
 4635 ttys000    0:00.24 node server.js
 4636 ttys000    0:00.38 /usr/local/bin/node /path/to/server.js
 4637 ttys000    0:00.38 /usr/local/bin/node /path/to/server.js
 4638 ttys000    0:00.38 /usr/local/bin/node /path/to/server.js
 4639 ttys000    0:00.39 /usr/local/bin/node /path/to/server.js

Now I send SIGTERM to the master:

$ kill -s SIGTERM 4635

and I get this in the console output:

ns=clusterflock pid=4635 type=master evt="received SIGTERM, sending myself SIGQUIT"
ns=clusterflock pid=4635 type=master evt="received SIGQUIT, attempting graceful shutdown"
ns=clusterflock pid=4635 type=master evt="worker (pid 4636) disconnected"
ns=clusterflock pid=4635 type=master evt="worker (pid 4637) disconnected"
ns=clusterflock pid=4635 type=master evt="worker (pid 4638) disconnected"
ns=clusterflock pid=4635 type=master evt="all workers disconnected"
ns=clusterflock pid=4635 type=master evt="worker (pid 4639) disconnected"
ns=clusterflock pid=4635 type=master evt="timeout exceeded, forcing shutdown"
ns=clusterflock pid=4635 type=master evt="received SIGTERM, ignoring (already shutting down)"
ns=clusterflock pid=4638 type=worker evt="ignoring SIGTERM, waiting for master to disconnect"
ns=clusterflock pid=4637 type=worker evt="ignoring SIGTERM, waiting for master to disconnect"
ns=clusterflock pid=4636 type=worker evt="ignoring SIGTERM, waiting for master to disconnect"
ns=clusterflock pid=4639 type=worker evt="ignoring SIGTERM, waiting for master to disconnect"

all processes are still running:

$ ps
  PID TTY           TIME CMD
  467 ttys000    0:00.85 -bash
 4635 ttys000    0:00.24 node server.js
 4636 ttys000    0:00.39 /usr/local/bin/node /path/to/server.js
 4637 ttys000    0:00.38 /usr/local/bin/node /path/to/server.js
 4638 ttys000    0:00.38 /usr/local/bin/node /path/to/server.js
 4639 ttys000    0:00.39 /usr/local/bin/node /path/to/server.js

Allowing more than just http

It would be nice if this could be used for more than just http servers. Maybe the interface could be passed in as an option and default to http if not set:

var interface = options.interface ? options.interface : http;
interface.createServer(handler);
interface.listen(options.port);

It would also need to support interface specific options such as certs/keys for https. Thoughts?

(Edit: maybe not interface as that's a reserved word, but you get the idea.)

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.