node-memcache icon indicating copy to clipboard operation
node-memcache copied to clipboard

Exceptions while big load

Open shunanya opened this issue 12 years ago • 8 comments

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

shunanya avatar Aug 29 '12 09:08 shunanya

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.

hbhasker avatar Oct 08 '12 18:10 hbhasker

+1

giggsey avatar Nov 05 '12 11:11 giggsey

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

1999 avatar Jan 07 '13 18:01 1999

Hey guys, we are having a similar issue. Is there a work around?

henpatel avatar May 31 '13 17:05 henpatel

@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.

1999 avatar Jun 03 '13 16:06 1999

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. (/Server/node_modules/memcache/lib/memcache.js:62:12) at Socket.EventEmitter.emit (events.js:95:17) at Socket. (stream_readable.js:736:14) at Socket.EventEmitter.emit (events.js:92:17) at emitReadable (_stream_readable.js:408:10) at emitReadable (_stream_readable.js:404:5) at readableAddChunk (_stream_readable.js:165:9) at Socket.Readable.push (_stream_readable.js:127:10)

masonzhang avatar Jul 30 '13 03:07 masonzhang

I Have the same error, and I tryed with compress the data and fails.

exos avatar Oct 10 '13 11:10 exos

@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.

masonzhang avatar Oct 10 '13 14:10 masonzhang