Blocking calls not working as expected in the case of disconnections
See original GitHub issueWe are having a serious issue in bull (https://github.com/OptimalBits/bull/issues/890), where the queue stops processing commands in the event of disconnections. I have tracked it down to be an issue in ioredis. It seems that blocking commands are not handled properly in the case of disconnections. It is very easy to reproduce, but there are many cases to consider. Here I report the most obvious ones.
Code to reproduce:
const Redis = require('ioredis');
const redis = new Redis();
redis.brpoplpush('source', 'destination', 10).then(function(result){
console.log(result)
}, function(err){
console.error(err);
});
redis.on('error', function(err){
// Outcommented to avoid noise.
/ /console.log('ERROR EVENT', err);
});
Case 1. Disconnect before calling blocking command.
Behaviour Dangling call, nothing happens for ever. Expected Error or at least timeout after given timeout.
Case 2. Connected before calling command, disconnected afterwards.
Behaviour Dangling call, nothing happens for ever. Expected Error or at least timeout after given timeout.
Case 3. Connected before calling blocking command, disconnected and then reconnected.
Behaviour Dangling call, nothing happens for ever. Expected Error or at least timeout after given timeout.
Case 4. Disconnected before calling blocking command, connected afterwards.
Behaviour Timeout after 10 seconds after reconnection.
Expected Works as expected?
Since the blocking command is not cancelable (https://github.com/luin/ioredis/issues/516), there is currently no workaround I know of for this, and you may end with a dangling client, so I think this issue is quite serious but please lets discuss it.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:10
- Comments:13 (1 by maintainers)
Top GitHub Comments
@carly not yet. I need to provide better test code for @luin but I did not have enough time for it, I will try to prioritize it.
ok, I try to test again with a reproducible environment.