Skip to content

Commit

Permalink
fix: Fix undefined property warning in executeAutoPipeline (#1425)
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
#1248

I suspect the process.exec might call the callback synchronously in the
same tick in some cases, immediately deleting the autopipeline from
running pipelines?
  • Loading branch information
TysonAndre authored Aug 30, 2021
1 parent cba83cb commit f898672
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 f898672

Please sign in to comment.