-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix TypeError: Cannot call method 'toString' of null #541
Conversation
+1 |
That looks reasonable to me. @brycebaril, your thoughts? |
Any updates on this? Thanks! |
@@ -364,7 +364,7 @@ RedisClient.prototype.on_ready = function () { | |||
RedisClient.prototype.on_info_cmd = function (err, res) { | |||
var self = this, obj = {}, lines, retry_time; | |||
|
|||
if (err) { | |||
if (err || !res) { | |||
return self.emit("error", new Error("Ready check failed: " + err.message)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is no err won't err.message throw a TypeError here?
Help me understand what this fixes and why the fix works... (see my comment on the commit) |
Good catch on that. Fixed. As for what it fixes, we were seeing logs like the one above where |
Any update on this? |
+1 plea for merging, this crashes our node process every few weeks |
The reasons I have not merged this yet are there are no tests or a reproduction case, but primarily, I don't believe this is actually a workable solution to this problem. The server is replying with no What's most likely happening here is a redis-as-a-service is being used, and it is via-configuration or via-proxy returning If there is another reason that the info command is replying with This is obviously impacting multiple people so something should be done soon, but until we know the correct path to take because we know why it is happening, I'm not eager to commit to either direction. |
@devongovett How does hiredis behave here? |
@devongovett @cstigler @xdamman @Philmod I'd like to fix this issue in 2.1. Could anyone of you give me any insights on the redis server and check what it returns when running a info command against it? |
@BridgeAR this has not crashed our server since December 2014. This is weird, since it was crashing every few weeks for several months before that. Not sure what the cause for the improvement was. |
Same, haven't seen this issue in a long time. But IMHO this kind of defensive programming is still a good idea to prevent crashes due to unknown responses from redis. |
That's strange. Was there any version update in the mean time? I guess not? |
It should emit an error rather than throw an uncaught exception. From our logs: