Automattic / Automattic/kue

TypeError: Cannot read property 'zcard' of null

Open
#825 8 comments 0 reactions 0 assignees View on GitHub
Bug in progress Optimization
Dominant language
JavaScript
Stars
9.4k
Forks
858
PR merge metrics
No merged PRs in 30d

Description

```
TypeError: Cannot read property 'zcard' of null
at Queue.card (/Users/andrew/Code/send/node_modules/kue/lib/kue.js:513:14)
at Queue.inactiveCount (/Users/andrew/Code/send/node_modules/kue/lib/kue.js:616:17)
at _ (/Users/andrew/Code/send/node_modules/kue/lib/http/routes/json.js:318:19)
at exports.stats (/Users/andrew/Code/send/node_modules/kue/lib/http/routes/json.js:41:3)
at Layer.handle [as handle_request] (/Users/andrew/Code/send/node_modules/kue/node_modules/express/lib/router/layer.js:95:5)
at next (/Users/andrew/Code/send/node_modules/kue/node_modules/express/lib/router/route.js:131:13)
at /Users/andrew/Code/send/node_modules/kue/lib/http/middleware/provides.js:11:36
at Layer.handle [as handle_request] (/Users/andrew/Code/send/node_modules/kue/node_modules/express/lib/router/layer.js:95:5)
at next (/Users/andrew/Code/send/node_modules/kue/node_modules/express/lib/router/route.js:131:13)
at Route.dispatch (/Users/andrew/Code/send/node_modules/kue/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/Users/andrew/Code/send/node_modules/kue/node_modules/express/lib/router/layer.js:95:5)
at /Users/andrew/Code/send/node_modules/kue/node_modules/express/lib/router/index.js:277:22
at Function.process_params (/Users/andrew/Code/send/node_modules/kue/node_modules/express/lib/router/index.js:330:12)
at next (/Users/andrew/Code/send/node_modules/kue/node_modules/express/lib/router/index.js:271:10)
at SendStream.error (/Users/andrew/Code/send/node_modules/kue/node_modules/express/node_modules/serve-static/index.js:120:7)
at emitOne (events.js:77:13)
at SendStream.emit (events.js:169:7)
at SendStream.error (/Users/andrew/Code/send/node_modules/kue/node_modules/express/node_modules/send/index.js:245:17)
at SendStream.onStatError (/Users/andrew/Code/send/node_modules/kue/node_modules/express/node_modules/send/index.js:356:12)
at next (/Users/andrew/Code/send/node_modules/kue/node_modules/express/node_modules/send/index.js:630:16)
at onstat (/Users/andrew/Code/send/node_modules/kue/node_modules/express/node_modules/send/index.js:619:14)
at FSReqWrap.oncomplete (fs.js:82:15)
```

I get this error pretty consistently under the following conditions:
1. Have kui ui open in a browser window
2. perform graceful shutdown

I'm not certain if it is expected for Queue.client to be null. If it is, then `Queue.prototype.card` should first check if `this.client` exists before calling `this.client.card`. Same with `Queue.prototype.cardByType`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in lib/kue.js at Queue.prototype.card and Queue.prototype.cardByType, then trace the stats path in lib/http/routes/json.js around lines 318 and 41. Reproduce with the Kue UI open during graceful shutdown and verify that the stats request no longer raises the reported TypeError; add or update a regression test if the repository has coverage for this lifecycle.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, redis
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.