memcached icon indicating copy to clipboard operation
memcached copied to clipboard

memcached.end() not works

Open breeeew opened this issue 9 years ago • 5 comments

In first console:

var memc = new Memcached("127.0.0.1:11211");
memc.add("foo", "bar", 10000, function(err, data){console.log(data)});
memc.get("foo", function(err, data){console.log(data)});

Second console:

var memc = new Memcached("127.0.0.1:11211");
memc.get("foo", function(err, data){console.log(data)});

And now in first console:

memc.end();
memc.get("foo", function(err, data){console.log(data)}); // it works, but expected memc is closed after .end()

And in second console:

memc.end();
memc.get("foo", function(err, data){console.log(data)}); // it works too

Documentation says it close ALL active connectkions:

memcached.end Closes all active memcached connections.

breeeew avatar May 26 '15 07:05 breeeew

I meet the same question!

lushijie avatar Apr 01 '17 07:04 lushijie

Did any 1 of you have resolved this? I tried changing the code to experiment different end/release method to remove connection. Like in memcahced.end method added

manager.end();//pool
manager.release();//pool
memcached.connections[key].end(true);//replace free with end with hard set to true to force destroy connection

But all of them fails...

Any 1 has any update or solution/alternate to this issue. It is(may be) causing serious issue when there traffic on server is coming with 8k qps.

thevirus20 avatar Aug 07 '17 19:08 thevirus20

I meet the same question too!

cleverzhang avatar Mar 22 '18 03:03 cleverzhang

Same here - tested with NodeJS 8.x and 10.x

viamuli avatar Feb 01 '19 14:02 viamuli

Still having this issue with Node.js 14 LTS. Decided to use memjs instead, it also supports promises.

taimoorgit avatar Feb 05 '21 00:02 taimoorgit