Giter VIP home page Giter VIP logo

memcached's People

Contributors

3rd-eden avatar bbamsch avatar ctavan avatar danielchencreditkarma avatar fkei avatar fouber avatar gamedev8 avatar hiramatsu-kosuke avatar ianshward avatar icecubed avatar jkrems avatar jpalardy avatar kahing avatar kcarlson avatar kevin-greene-ck avatar lackac avatar makerandrew avatar peters avatar pmark avatar privman avatar qard avatar ramakrishna-battala-ck avatar rcoup avatar rdzar avatar roylines avatar ryansname avatar schloerke avatar sebastianseilund avatar tmuellerleile avatar yyydao avatar

Stargazers

 avatar  avatar  avatar

Watchers

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

memcached's Issues

Uncatchable crash if `ping` command not available - returns "spawn ping ENOENT"

See 3rd-Eden#342 for the original, the same issue exists in this fork. I've repasted the contents below.

If you get in a state where memcached attempts to reconnect, it will call ping(this.tokens[1]), which attempts to spawn a binary to call ping -c 3. The ping function in Javascript does not handle the case where the ping binary is not present - specifically it's missing an .on(error) handler that could catch the situation where ping is not found, has the wrong permissions, or the running process does not have permission to spawn children.

function ping (host, callback) {
  var isWin = process.platform.indexOf('win') === 0; // win32 or win64
  var arg = isWin ? '-n' : '-c';
  var pong = spawn('ping', [arg, '3', host]); // only ping 3 times

  pong.stdout.on('data', function stdoutdata (data) {
    callback(false, data.toString().split('\n')[0].substr(14));
    pong.kill();
  });

  pong.stderr.on('data', function stderrdata (data) {
    callback(new Error(data.toString().split('\n')[0].substr(14)), false);
    pong.kill();
  });
}

The lack of a .on('error') handler means that any failure here is uncatchable and crashes the process.

More broadly I have to wonder about the effectiveness of calling ping if a connection fails - it's not clear that one TCP packet is going to have any more luck than another if the connection is in trouble.

Configuration best practices

I'm facing the same issue as described here: 3rd-Eden#339

I'm still using 3rd-Eden package, but worth the shot asking here if you know how this issue could be solved.

My current config is and I don't run in cluster mode:

const memcached = new Memcached(MEMCACHED_ADDRESS, {
  maxExpiration: MAX_EXPIRATION_TIME,
  maxValue: 2097152, // Max length of cache value in bytes
  timeout: 3000, // after x ms the server should send a timeout if we can't connect
  poolSize: 50, // maximal parallel connections
  retries: 2, // Connection pool retries to pull connection from pool
  minTimeout: 500, // Connection pool retry min delay before retrying
  maxTimeout: 1000, // Connection pool retry max delay before retrying
  retry: 1000, // When a server has an error, wait this amount of time before retrying
})

I'm also wondering if this was a 1-to-1 rewrite or did you guys fix any bugs and are going to maintain this lib?

It is my interest to update to a lib that at least is minimally maintained

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.