node-memcache
node-memcache copied to clipboard
Exceptions while big load
When I use memcache library on big load (more than 20 req/sec) I am get the exception during getting data like depicted below
/home/shunanya/worksp_node/test/node_modules/memcache/lib/memcache.js:260 var type = this.callbacks[0].type; ^ TypeError: Cannot read property 'type' of undefined at Client.determine_reply_handler (/home/shunanya/worksp_node/test/node_modules/memcache/lib/memcache.js:260:30) at Client.handle_received_data (/home/shunanya/worksp_node/test/node_modules/memcache/lib/memcache.js:217:21) at Socket.Client.connect.conn.addListener.self.conn (/home/shunanya/worksp_node/test/node_modules/memcache/lib/memcache.js:62:12) at Socket.EventEmitter.emit (events.js:88:17) at TCP.onread (net.js:403:14)
In my opinion, it doesn't have enough time to store the callback function in the array and this is the reason for exception. I use currently the Node.js 0.8.8 and Memcached 1.4.14 under Ubuntu 11.10. Hope, this issue can be fixed soon:)
Simon
This is an issue I am noticing as well. From what I can see it fires the callback before the data is complete or something sometimes or is firing a callback when none exist.
+1
It seems like the error does not depend on the number of the tasks being made to memcached server. Some piece of data comes when no listener is bound. The data comes without any request being made to memcached server, so the problem is to get what is this piece of data about.
// dirty hack (stderr will also contain the data):
this.conn.addListener("data", function (data) {
self.buffer += data;
try {
self.handle_received_data();
} catch (e) {
util.error('Error: data handling impossible. Data chunk: ' + data);
self.buffer = '';
}
});
UPD: i created a gist repository to reproduce this problem: https://gist.github.com/4554582 Pull request from issue #22 fixes this just partly
Hey guys, we are having a similar issue. Is there a work around?
@henpatel i moved to npm's memcached, but found another bug. Whoa! If you want to continue using node-memcache, look #22 for partial fix of this problem.
This happens on my server also, I use latest node-memcache and Couchbase to setup memcached server. Any thoughts? Here are my full call stack:
/Server/node_modules/memcache/lib/memcache.js:260
var type = this.callbacks[0].type;
^
TypeError: Cannot read property 'type' of undefined
at Client.determine_reply_handler (/Server/node_modules/memcache/lib/memcache.js:260:30)
at Client.handle_received_data (/Server/node_modules/memcache/lib/memcache.js:217:21)
at Socket.
I Have the same error, and I tryed with compress the data and fails.
@exos The answer is in comment of the user "1999". Pull Request #23: Fixed bug when 'END' is contained in the cached data. But it does not completely fix this issue.