Skip to content
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

When using Bluebird warning are raied about created but not returned promises #90

Closed
wants to merge 1 commit into from

Conversation

Setitch
Copy link

@Setitch Setitch commented Sep 15, 2021

(node:191) Warning: a promise was created in a handler as internals/timers.js:461:21 but was not returned from it, see http://goo.gl/rRqMUw at function.originalPromiseResolve (/..../node_modules/bluebird/js/release/promise.js:225:13)
To fix that,variables pullAlgorithm and cancelAlgorithm were defined with default promise on them and then reassigned with new promises.

When using node streams in functions SetUpReadableByteStreamControllerFromUnderlyingSource and SetUpReadableStreamDefaultControllerFromUnderlyingSource 2 Promises (for each function) were created and then replaced (without executing them) with new ones. This fixes that.

This only occured while project was using Bluebird promises.

…promises

```(node:191) Warnin: a promise was created in a handler as internals/timers.js:461:21 but was not returned from it, see http://goo.gl/rRqMUw at function.originalPromiseResolve (/..../node_modules/bluebird/js/release/promise.js:225:13)```
To fix that,variables `pullAlgorithm` and `cancelAlgorithm` were defined with default promise on them and then reassigned with new promises.
@MattiasBuelens
Copy link
Owner

I don't quite understand why this would fix the warning. pullAlgorithm and cancelAlgorithm are functions returning a promise, not promises themselves. They are re-assigned before they ever get called, so why would Bluebird complain about a promise that was created in a handler? 😕

Do you have some sample code or a minimal reproduction case that demonstrates the problem?

If this fix is indeed correct, then I assume we have to do the same for SetUpWritableStreamDefaultControllerFromUnderlyingSink and SetUpTransformStreamDefaultControllerFromTransformer?

@Setitch
Copy link
Author

Setitch commented Sep 15, 2021

I must say i dont know, but several warning dissapeared when i just changed, im already quite exhousted from tracking all places this warnings are made from top to bottom and slowly get rid of all, this might be even my mistake and this only fixes memory usage (as it do not override already created value for variable with new one

@MattiasBuelens
Copy link
Owner

Sure, I agree that the code looks nicer without the re-assignments. I'm not sure if it's gonna affect memory usage all that much, I'd imagine a JIT compiler could figure out that the initial value isn't actually used when underlyingSource.pull exists.

As it happens, I ran into a similar issue at my day job where we're also using the polyfill together with Bluebird. In that case, we simply disabled the warnings (🙈), but I'll try to find some time to figure out why this is happening. No promises though! 😅

@Setitch
Copy link
Author

Setitch commented Sep 15, 2021

I still have some of the warnings - for example when writer was released in WriteableStreamDefatultWriterRelease(writer) i also get this warnings. Oh btw - maybe that will also help - the library that i use is openpgp while streaming files to encrypt/decrypt.

@MattiasBuelens
Copy link
Owner

If at all possible, could you share the repository where you're seeing this problem? Or some way for me to try and reproduce it on my end?

@MattiasBuelens
Copy link
Owner

Figured it out. Fix is in #91. 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants