caolan / caolan/highland

Pushing nil asynchronously to short-circuit a stream cause deadlock

Open
#563 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.