-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strange null rejection related to method wrapping, finally and binding (regression) #417
Comments
Oh I forgot to mention that this gives me the following error:
|
If this is what reduced case looks like, I am scared what the real code is :D Anyway, thanks I am looking into it. |
haha it's a bit more clean in my library. There are probably somethings related to promises that I can implement in a smarter way, but I find that in certain cases it's hard to predict how some things in bluebird are going to behave, so in those cases I am a little bit more verbose to be on the safe side. (still 100x better than callbacks or fibers though :D) The issue is very finicky, if I remove certain lines (e.g. the bind, the finally or the method call) the issue is suddenly gone. The issue is also gone if I add a .catch() before the finally() |
Yeah the library code is clean (I was wondering about all the method() calls in the repro), however you only need My repro is currently: var bound = new String("asd");
var bar = Promise.try(Promise.delay, 0, 0);
Promise.resolve()
.thenReturn(bar)
.bind(bound)
.finally(function() {
return Promise.resolve(1);
})
.then(function() {
done();
}); |
This is a race condition in the deep core, nothing special (as in other than constructor and .then) needed to repro: var promise = new Promise(function(resolve) {
resolve(Promise.resolve().then(function() {
return new Promise(function(resolve) {
setTimeout(resolve, 0);
});
}));
});
promise.then(function() {
assert(promise.isResolved());
done();
});
|
Do you think this issue was introduced in the last two versions or did those changes just affect the timing? |
2.4.3 introduced a fix for the memory leak described here, which forced a big change in the foundations. I specified the change needed in the spec to avoid the memory leak here promises-aplus/promises-spec#179 (comment)
|
Tested in 2.5.0, this does not occur in bluebird 2.4.2
I am not sure what is going wrong, but this is what I reduced my issue to:
The text was updated successfully, but these errors were encountered: