Skip to content

Conversation

@gstringfellow
Copy link

@gstringfellow gstringfellow commented May 3, 2016

Pull Request check-list

Please make sure to review and check all of these items:

  • Does npm test pass with this change (including linting)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.

Description of change

Sometimes command_obj is null and causes node to spit-up an Error with 'TypeError: Cannot read property 'callback' of undefined'. This change fixes that. This problem might be windows specific.

@BridgeAR
Copy link
Contributor

BridgeAR commented May 3, 2016

@gstringfellow There should always be a command_obj, otherwise there's a error somewhere else.

Do you have a reproducible test case? Otherwise please also activate the debug_mode to make it easier to spot the error.

@BridgeAR
Copy link
Contributor

BridgeAR commented May 4, 2016

This is a blocker for me to release v.2.6. Could you provide some more details for me? This would be very helpful!

@gstringfellow
Copy link
Author

I am running windows 8 with redis 2.8.24 running on my local machine; connecting to an external redis instance (on aws) runs fine. I ran node_redis with debug_mode but the output did'nt reveal anything to me. The Throw happens during initialization of node_redis before I run any commands with it. What follows is the output and the stacktrace.

`Stream connected 127.0.0.1:6379 id 0
Checking server ready state...
Send 127.0.0.1:6379 id 0: *1
$4
info

Stream connected 127.0.0.1:6379 id 1
Checking server ready state...
Send 127.0.0.1:6379 id 1: *1
$4
info

Stream connected 127.0.0.1:6379 id 2
Checking server ready state...
Send 127.0.0.1:6379 id 2: *1
$4
info

Net read 127.0.0.1:6379 id 0
Redis server ready.
on_ready called 127.0.0.1:6379 id 0
Net read 127.0.0.1:6379 id 1
Redis server ready.
on_ready called 127.0.0.1:6379 id 1
Net read 127.0.0.1:6379 id 2
Redis server ready.
on_ready called 127.0.0.1:6379 id 2
Sending offline command: monitor
Send 127.0.0.1:6379 id 2: *1
$7
monitor

Net read 127.0.0.1:6379 id 2
redis:main [8488] RedisClient entering monitoring mode. +20ms
c:\Users\gstringfellow\Code\SVO\poc-server\node_modules\redis\index.js:616
if ( typeof command_obj.callback === 'function') {
^

TypeError: Cannot read property 'callback' of undefined
at normal_reply (c:\Users\gstringfellow\Code\SVO\poc-server\node_modules\redis\index.js:616:28)
at RedisClient.return_reply (c:\Users\gstringfellow\Code\SVO\poc-server\node_modules\redis\index.js:719:9)
at JavascriptReplyParser.self.reply_parser.returnReply (c:\Users\gstringfellow\Code\SVO\poc-server\node_modules\redis\lib\individualCommands.js:63:22)
at JavascriptReplyParser.run (c:\Users\gstringfellow\Code\SVO\poc-server\node_modules\redis\node_modules\redis-parser\lib\javascript.js:137:18)
at JavascriptReplyParser.execute (c:\Users\gstringfellow\Code\SVO\poc-server\node_modules\redis\node_modules\redis-parser\lib\javascript.js:112:10)
at Socket. (c:\Users\gstringfellow\Code\SVO\poc-server\node_modules\redis\index.js:240:27)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:146:16)
at Socket.Readable.push (_stream_readable.js:110:10)
at TCP.onread (net.js:523:20)
`

@BridgeAR
Copy link
Contributor

BridgeAR commented May 4, 2016

The output looks like it has something to do with the monitor command. You open three clients and fire monitor with one of them. As soon as it's connected and the monitor command is called, it throws... Would you be so kind and show the code that reproduces the error? And are you able to trigger the error in a local test?
As far as I see it this might be a race condition. To verify that you could add this.monitoring = true; in the individual commands line 63. That might solve the issue.

@gstringfellow
Copy link
Author

redisClient.monitor(function (err, res) { debug("RedisClient entering monitoring mode."); });

The above is the offending set of lines. I added the statement and removed the null check,but no change it still threw.
There are at least 2 connections to redis one in the main process and then one for each processor (we use clustering with socket.io-redis).

@BridgeAR
Copy link
Contributor

BridgeAR commented May 4, 2016

Would you be so kind and try to find a way to reduce your code to the absolute minimal to reproducible this as a standalone program? Or would there be any other way to have a closer look at what is happening?
The current information is not enough for me to see the error.

@BridgeAR
Copy link
Contributor

BridgeAR commented Jun 1, 2016

@gstringfellow would you be so kind and check if #1074 fixes your issue?

@BridgeAR BridgeAR closed this Jun 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants