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

RunTime Error

Open defjamuk opened this issue 10 years ago • 0 comments

I reliably get a runtime error if I repeatedly open and close socket.io connections when using node-redis as the socket.io backing store, as follows --

/node_modules/node-redis/index.js:156 var type = reply[0].toString(); ^ TypeError: Cannot read property '0' of undefined at EventEmitter.onReply (/node_modules/node-redis/index.js:156:25) at EventEmitter.emit (events.js:92:17) at Socket.onClose (/node_modules/node-redis/index.js:139:21) at Socket.EventEmitter.emit (events.js:117:20) at _stream_readable.js:920:16 at process._tickCallback (node.js:415:13)

I can defend against this error by checking the reply object is valid before indexing into the array ---

changing line 154 from: if (false !== self.blocking) { to: if (false !== self.blocking && reply) {

defjamuk avatar Jun 06 '14 16:06 defjamuk