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

TypeError: Cannot read property 'length' of null

Open Valid opened this issue 14 years ago • 5 comments

TypeError: Cannot read property 'length' of null at Client.handlePublishedMessage_ (/home/phazm/.node_libraries/redis-node-client/lib/redis-client.js:423:42) at Client.onReply_ (/home/phazm/.node_libraries/redis-node-client/lib/redis-client.js:390:14) at /home/phazm/.node_libraries/redis-node-client/lib/redis-client.js:136:34 at ReplyParser.feed (/home/phazm/.node_libraries/redis-node-client/lib/redis-client.js:198:25) at Stream. (/home/phazm/.node_libraries/redis-node-client/lib/redis-client.js:337:28) at Stream.emit (events:25:26) at IOWatcher.callback (net:369:16) at node.js:204:9

Using the latest from HEAD for redis, node, and redis-node-client

I'm not actually doing anything with pubsub, so I think there's an errant call somewhere, when it's running the code when it doesn't need to.

Valid avatar Jun 25 '10 06:06 Valid

I'm getting this too.

Here is how you reproduce it:

redis.hmget("AntKey", "any0", "any1", "any2", "any3", function() {} );

That will produce this exception:

                      reply.value[0].value.length == 8 &&
                                          ^
TypeError: Cannot read property 'length' of null
    at Client.handlePublishedMessage_ (/mnt/compendium/DevLab/lib/redis-node-client/lib/redis-client.js:427:43)
    at Client.onReply_ (/mnt/compendium/DevLab/lib/redis-node-client/lib/redis-client.js:390:14)
    at /mnt/compendium/DevLab/lib/redis-node-client/lib/redis-client.js:136:34
    at ReplyParser.feed (/mnt/compendium/DevLab/lib/redis-node-client/lib/redis-client.js:183:29)
    at Stream. (/mnt/compendium/DevLab//lib/redis-node-client/lib/redis-client.js:337:28)
    at Stream.emit (events:25:26)
    at IOWatcher.callback (net:510:16)
    at node.js:228:9

You get a slightly different error if you reduce the number of keys requested down to 3.

If you reduce it to two, it doesn't throw any exceptions.

Sembiance avatar Jul 04 '10 06:07 Sembiance

I made a patch, you can find it here: http://www.telparia.com/redis-client.js.patch

Seems to work, but I don't have enough understanding of the code to know whether or not this causes more issues.

Sembiance avatar Jul 04 '10 06:07 Sembiance

Seeing the same issue, patched seemed to fix it for me as well. Getting error on a "smembers" call.

MiketoString avatar Sep 23 '10 01:09 MiketoString

It looks like this happens when you do a hmget on a key that doesn't exist yet.

lacker avatar Oct 02 '10 00:10 lacker