Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server never marked as down and never removed #16

Closed
subnetmarco opened this issue Oct 28, 2011 · 8 comments · Fixed by #114
Closed

Server never marked as down and never removed #16

subnetmarco opened this issue Oct 28, 2011 · 8 comments · Fixed by #114
Milestone

Comments

@subnetmarco
Copy link

When a server is unavailable the library doesn't mark it as down.

I initialize the client with this code:

    cache = new Memcached([ '127.0.0.1:11211', '127.0.0.1:11212' ], {
        remove: true,
        poolSize: 20,
        timeout: 3000,
        retries: 5,
        retry: 1000,
        reconnect: 1000
    });

Where 127.0.0.1:11212 is intentionally down.

And when I set a new object with:

cache.set(key, value, 0, function(err, result) {
    // Do something
});

I get the following exception:

Error: Can't set an object into cache: false
    at Object.callback (/Users/user/test/lib/cache.js:44:11)
    at EventEmitter.memcachedCommand [as command] (/Users/user/test/lib/memcached/memcached.js:184:93)
    at EventEmitter.setters (/Users/user/test/lib/memcached/memcached.js:610:15)
    at EventEmitter.set (/Users/user/test/lib/memcached/utils.js:68:17)

Which I shouldn't get because the other server is up and running.

I added some listeners like:

    cache.on('failure', function(details) { 
        console.log("Server " + details.server + " went down due to: " + details.messages.join( '' ));
    });

    cache.on('issue', function(details) { 
        console.log("Server " + details.server + " has an issue due to: " + details.messages.join( '' ));
    });

    cache.on('remove', function(details) { 
        console.log("Server " + details.server + " has been removed due to: " + details.messages.join( '' ));
    });

    cache.on('reconnecting', function(details) { 
        console.log("Reconnecting to server " + details.server + " due to: " + details.messages.join( '' ));
    });

    cache.on('reconnected', function(details) { 
        console.log("Successfully reconnected to server " + details.server);
    });

And I only get this message before the exception:

Server undefined has an issue due to: Error: ECONNREFUSED, Connection refused

Thus the library is not attempting to reconnect, and it's not removing the server. And in the message above it can't get the server address (it's "undefined").

@ozten
Copy link

ozten commented Jan 17, 2013

I'm also doing some manual testing, running two memcached and taking the first one listed offline.

I've tried various settings for timeout, retries, retry, and remove... but memcache keeps choosing the dead instance. It doesn't remove it from the pool.

For fallback I'm trying:

new Memcached('127.0.0.1:11211', {failOverServers: ['127.0.0.1:11212']});

(with other options and setting up event listeners, etc)

With 0.1.5, I don't get any issues logged.

With 0.0.11 I do get

{"level":"error","message":"Connect did not give a server","timestamp":"2013-01-17T21:19:43.778Z"}
{"level":"error","message":"memcached raised an issue: {\"tokens\":[\"11211\",\"localhost\"],\"messages\":[{\"code\":\"ECONNREFUSED\",\"errno\":\"ECONNREFUSED\",\"syscall\":\"connect\"}],\"retries\":2,\"totalRetries\":0}","timestamp":"2013-01-17T21:19:43.782Z"}
{"level":"error","message":"Connect did not give a server","timestamp":"2013-01-17T21:20:03.994Z"}
{"level":"error","message":"memcached raised an issue: {\"tokens\":[\"11211\",\"localhost\"],\"messages\":[{\"code\":\"ECONNREFUSED\",\"errno\":\"ECONNREFUSED\",\"syscall\":\"connect\"},{\"code\":\"ECONNREFUSED\",\"errno\":\"ECONNREFUSED\",\"syscall\":\"connect\"}],\"retries\":1,\"totalRetries\":1}","timestamp":"2013-01-17T21:20:03.999Z"}

My expectation was for there to be a failure, the server to be removed, and eventually the library would try to add the server back in after reconnect milliseconds.

@3rd-Eden
Copy link
Owner

I put this issue under the 1.0 milestone that I have scheduled to release on the 30th

@mridgway
Copy link

mridgway commented Mar 8, 2013

Is there a new timeline for this?

@3rd-Eden
Copy link
Owner

3rd-Eden commented Mar 8, 2013

@mridgway not really, I under estimated the work that was needed for a stable 1.0 I'm working on & off on it atm. Sorry that I cannot provide you with more specific details.

@lpalomero
Copy link

Hello, how is it going this issue?

@ianshward
Copy link
Collaborator

@3rd-Eden do you have a general idea of what the issue may be? I may look into this.

@ianshward
Copy link
Collaborator

This should be working now in master, fixed in #132 and a few other recent commits.

@ozten
Copy link

ozten commented Jul 25, 2013

Hawt!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants