Bug from 8f62f16: Unix domain socket; ERR invalid DB index
See original GitHub issuevar kue = require('kue');
kue.createQueue({
redis: {
socket: '/path/to/redis_sock',
},
});
throws an unhandled exception: “ReplyError: ERR invalid DB index”
This is due to changes in lib/redis.js introduced in 8f62f16:
Line 114: var db = !socket ? (options.redis.db || 0) : null;
Line 119-121: if( db >= 0 ){ client.select(db); }
Since (null >= 0) === true
, client.select(null)
will be run when initiating the redis connection over a socket path, resulting in the mentioned error. I made the pull request #999 a while back to fix this. A similar solution would be to change line 114 to var db = !socket ? (options.redis.db || 0) : undefined;
but I was not sure if setting to undefined would be accepted as it seems to go against the programming style. If you prefer db = undefined
, let me know and I’ll amend my PR.
When I submitted this pull request, I was mistakenly thinking, that #396 was referencing the same issue, now I realize that the bug was not introduced until October 2015. Please merge this request, as unix domain sockets are quite useful on shared hosting environments.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:6
Top GitHub Comments
would it be possible to merge this @behrad ? I’ve had the patch in production for some time now, without any issue to report.
Oh, didn’t notice the PR, my bad!