Skip to content

Commit

Permalink
Fix undefined property warning in executeAutoPipeline
Browse files Browse the repository at this point in the history
Seen in an uncaughtException handler.

```
err_type=uncaughtException, exiting cause=TypeError: Cannot read property 'Symbol(callbacks)' of undefined
    at Immediate.executeAutoPipeline (.../node_modules/ioredis/built/autoPipelining.js:34:31)
    at Shim.applySegment (.../node_modules/newrelic/lib/shim/shim.js:1430:20)
    at Immediate.wrapper (.../node_modules/newrelic/lib/shim/shim.js:2097:17)
    at processImmediate (internal/timers.js:463:21)
```

A similar error was among the errors reported in
redis#1248

I suspect the async nature of the delete call may cause it to be
deleted.
  • Loading branch information
TysonAndre committed Aug 27, 2021
1 parent cba83cb commit 4bd4011
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/autoPipelining.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ function executeAutoPipeline(client, slotKey: string) {
if (client._runningAutoPipelines.has(slotKey)) {
return;
}
if (!client._autoPipelines.has(slotKey)) {
/*
Rare edge case. Somehow, something has deleted this running autopipeline in an immediate
call to executeAutoPipeline.
Maybe the callback in the pipeline.exec is sometimes called in the same tick,
e.g. if redis is disconnected?
*/
return;
}

client._runningAutoPipelines.add(slotKey);

Expand Down

0 comments on commit 4bd4011

Please sign in to comment.