Pushing nil asynchronously to short-circuit a stream cause deadlock
Open
- Dominant language
- JavaScript
- Stars
- 3.4k
- Forks
- 145
- PR merge metrics
- No merged PRs in 30d
Description
This code doesn't work. "done" is never printed.
``` javascript
_([1])
.consume(function (err, x, push, next) {
if (err) {
push(err);
next();
} else if (x === _.nil) {
push(null, _.nil);
} else {
setTimeout(function () {
push(null, _.nil);
}, 0);
}
})
.done(function () {
console.log('done');
});
```
Spotted when looking at #558.
Contributor guide
Research direction
Start by running the JavaScript reproduction in the issue and compare its behavior with the related discussion in #558. Trace how consume handles the asynchronous push of _.nil; done should be printed without the stream deadlocking.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- stream-processing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100