Kue is swallowing errors from Redis
- Dominant language
- JavaScript
- Stars
- 9.4k
- Forks
- 858
- PR merge metrics
- No merged PRs in 30d
Description
hi,
I have a Nodejs (v8.11) application that writes data to Redis (v4.0.10) via Kue (v0.11.6).
I sat a maxmemory limit to Redis and when I reach that limit **Kue doesn't properly handle errors from redis**.
The bugged function is [this](https://github.com/Automattic/kue/blob/master/lib/queue/job.js#L827) in detail [here](https://github.com/Automattic/kue/blob/master/lib/queue/job.js#L867).
```
this.set('data', json, function() { // missing return parameters (err, foo)
// state
this.state(this._state, fn);
}.bind(this));
```
where the callback function doesn't handle return parameters.
This bug is swallowing important Redis' errors like
> OOM command not allowed when used memory > 'maxmemory'
does anyone have a patch that solve this and allow me to take errors back to the main function caller in order to handle it?
can this snippet solve cleanly the problem, @behrad?
```
this.set('data', json, function (err) { // <=== err added
if (err) return fn(err); // <=== return the error
// state
this.state(this._state, fn);
}.bind(this));
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Inspect lib/queue/job.js around lines 827 and 867, starting with the set('data', json, ...) callback shown in the issue. Trace how Redis callback errors should reach the main caller, then reproduce the maxmemory failure to verify that the OOM error is no longer swallowed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js, redis
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100